Exemplo n.º 1
0
centroidset_t *centroidset_new()
{
	jsw_rbtree_t *rbtree;
	rbtree = jsw_rbnew(centroid_cmp, centroid_dup, centroid_rel);

	return rbtree;
}
static void createAndStoreFileNames()
{
   int i= 0;
   char path[128] = {0};
   key_value_s* item;

   // create new tree
   gRb_tree_bl = jsw_rbnew(key_val_cmp, key_val_dup, key_val_rel);

   if(gRb_tree_bl != NULL)
   {
      while( i < (TOKENARRAYSIZE-1) )
      {
         if(gpTokenArray[i+1]  != 0 )
         {
            memset(path, 0, sizeof(path));
            snprintf(path, 128, "%s", gpTokenArray[i]);    // storage type

            item = malloc(sizeof(key_value_s));    // asign key and value to the rbtree item
            if(item != NULL)
            {
               //printf("createAndStoreFileNames => path: %s\n", path);
               item->key = pclCrc32(0, (unsigned char*)path, strlen(path));
               // we don't need the path name here, we just need to know that this key is available in the tree
               item->value = "";
               (void)jsw_rbinsert(gRb_tree_bl, item);
               free(item);
            }
            i+=1;
         }
         else
         {
            break;
         }
      }
   }
}
Exemplo n.º 3
0
cx_rbtree cx_rbtreeNew_w_func(cx_equalsAction compare) {
    return (cx_rbtree)jsw_rbnew(NULL, compare);
}
Exemplo n.º 4
0
cx_rbtree cx_rbtreeNew(cx_type keyType) {

    cx_assert(keyType->size <= sizeof(cx_word), "cx_rbtreeNew: keytype sizes cannot be larger than the size of a word.");

    return (cx_rbtree)jsw_rbnew(keyType, NULL);
}