Example #1
0
static int addrset_eq_onesidederr1 (const ut_avlCTree_t *at, const ut_avlCTree_t *bt)
{
  /* Just checking the root */
  if (ut_avlCIsEmpty (at) && ut_avlCIsEmpty (bt)) {
    return 1;
  } else if (ut_avlCIsSingleton (at) && ut_avlCIsSingleton (bt)) {
    const struct addrset_node *a = ut_avlCRoot (&addrset_treedef, at);
    const struct addrset_node *b = ut_avlCRoot (&addrset_treedef, bt);
    return compare_addr (&a->addr, &b->addr) == 0;
  } else {
    return 0;
  }
}
Example #2
0
int addrset_any_mc (const struct addrset *as, os_sockaddr_storage *dst)
{
  LOCK (as);
  if (ut_avlCIsEmpty (&as->mcaddrs))
  {
    UNLOCK (as);
    return 0;
  }
  else
  {
    const struct addrset_node *n = ut_avlCRoot (&addrset_treedef, &as->mcaddrs);
    *dst = n->addr;
    UNLOCK (as);
    return 1;
  }
}
Example #3
0
c_voidp
d_tableTake(
    d_table table)
{
    c_voidp result;

    result = NULL;
    if (table) {
        /* Delete an arbitrarily chosen node: the obvious candidates
           are: root, min and max.  */
        d_tableNode node;
        if ((node = ut_avlCRoot (&table->td, &table->tree)) != NULL) {
            result = node->object;
            ut_avlCDelete (&table->td, &table->tree, node);
            d_free(node);
        }
    }
    return result;
}