int tdbio_search_trust_byfpr( const byte *fingerprint, TRUSTREC *rec ) { int rc; /* locate the trust record using the hash table */ rc = lookup_hashtable( get_trusthashrec(), fingerprint, 20, cmp_trec_fpr, (void*)fingerprint, rec ); return rc; }
/* find a value in the hashtable or die if the key does not exist in the hash*/ void* must_find_hashtable(hashtable* const hash, const char* const name, const int len) { pre(name != NULL); bin* bin = lookup_hashtable(hash, name, len); if(bin == NULL){ fatalf("did not find %s in the hash", name); } return bin->val; }
/*look in the hashtable and return the value associated with the string of * length len. Returns NULL is the bin doesnt exist*/ void* find_value_hashtable(hashtable* const hash, const char* const name, const int len) { pre(name != NULL); bin* bin = lookup_hashtable(hash, name, len); if(bin == NULL){ return NULL; } return bin->val; }
void test_judySL() { l3obj* o = 0; make_new_obj("testclass","testclastobjname", defptag_get(),0,&o); l3path name("tester"); insert(&name, 0, main_env); llref* llr = (llref*)lookup_hashtable(main_env, name()); // can return 0. if (llr) { l3obj* found = llr->_obj; print(found,"",0); } }
VOID prn_grid(GRID *g) { INT i; INT n; GRID *ng; VOXEL *v; fprintf(stderr, " Print Grid %ld \n", g->id); fprintf(stderr, " num_prims = %ld \n", g->num_prims); fprintf(stderr, " indx_inc[0,1,2] = %ld, %ld, %ld \n", g->indx_inc[0], g->indx_inc[1], g->indx_inc[2]); fprintf(stderr, " num_buckets = %ld \n", g->num_buckets); fprintf(stderr, " min[0,1,2] = %lf, %lf, %lf \n", g->min[0], g->min[1], g->min[2] ); fprintf(stderr, " cellsize[0,1,2] = %lf, %lf, %lf \n", g->cellsize[0], g->cellsize[1], g->cellsize[2]); fprintf(stderr, " subdiv_level = %ld \n", g->subdiv_level); if (g->next != NULL) { ng = g->next; fprintf(stderr, " next grid id %ld \n", ng->id); } else fprintf(stderr, " next grid id NULL \n"); fprintf(stderr, " Voxel List \n"); n = g->indx_inc[1] * g->indx_inc[2]; for (i = 0; i < n; i++) { if (lookup_emptycells(i, g) == EMPTY) fprintf(stderr, " Voxel %ld is empty. \n", i); else { v = lookup_hashtable(i, g); prn_voxel(v); } } fprintf(stderr, " End Grid \n"); }