Exemplo n.º 1
0
void TSTree_traverse(TSTree *node, TSTree_traverse_cb cb, void *data)
{
  if(!node) return;

  if(node->low) TSTree_traverse(node->low, cb, data);
  if(node->equal) TSTree_traverse(node->equal, cb, data);
  if(node->high) TSTree_traverse(node->high, cb, data);
  if(node->value) cb(node->value, data);
}
Exemplo n.º 2
0
char *test_traverse()
{
    traverse_count = 0;
    TSTree_traverse(node, TSTree_traverse_test_cb, valueA);
    debug("traverse count is %d", traverse_count);
    mu_assert(traverse_count == 4, "Traverse count should be 4.");

    return NULL;
}
Exemplo n.º 3
0
void TSTree_traverse(TSTree *node, TSTree_traverse_cb cb, void *data)
{

  check(data != NULL, "Data can't be NULL");

  if(!node) return;

  if(node->low) TSTree_traverse(node->low, cb, data);

  if(node->equal) TSTree_traverse(node->equal, cb, data);

  if(node->high) TSTree_traverse(node->high, cb, data);

  if(!DArray_empty(node->values) && node != NULL) cb(node->values, data);

error:
  return;
}
Exemplo n.º 4
0
void TSTree_traverse(TSTree* node, TSTree_traverse_cb cb, void* data)
{
  if (!node) {
    return;
  }

  if (node->low) {
    TSTree_traverse(node->low, cb, data);
  }

  if (node->equal) {
    TSTree_traverse(node->equal, cb, data);
  }

  if (node->high) {
    TSTree_traverse(node->high, cb, data);
  }

  if (node->value) {
    cb(node->value, data);
  }
}
Exemplo n.º 5
0
 void destroy_routes(TSTree * routes)
 {
     TSTree_traverse(routes, bdestroy_cb, NULL);
     TSTree_destroy(routes);
 }