inc/hash.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hashEl
struct  hash
struct  hashCookie

Defines

#define hashMaxSize   24
#define hashNew(a)   newHash(a)
#define hashFree(a)   freeHash(a)

Functions

bits32 hashString (char *string)
bits32 hashCrc (char *string)
hashElhashLookup (struct hash *hash, char *name)
hashElhashLookupUpperCase (struct hash *hash, char *name)
hashElhashLookupNext (struct hashEl *hashEl)
hashElhashAdd (struct hash *hash, char *name, void *val)
hashElhashAddN (struct hash *hash, char *name, int nameSize, void *val)
void * hashRemove (struct hash *hash, char *name)
hashElhashAddUnique (struct hash *hash, char *name, void *val)
hashElhashAddSaveName (struct hash *hash, char *name, void *val, char **saveName)
hashElhashStore (struct hash *hash, char *name)
char * hashStoreName (struct hash *hash, char *name)
char * hashMustFindName (struct hash *hash, char *name)
void * hashMustFindVal (struct hash *hash, char *name)
void * hashFindVal (struct hash *hash, char *name)
void * hashOptionalVal (struct hash *hash, char *name, void *usual)
hashElhashAddInt (struct hash *hash, char *name, int val)
int hashIntVal (struct hash *hash, char *name)
int hashIntValDefault (struct hash *hash, char *name, int defaultInt)
long long hashIntSum (struct hash *hash)
void hashTraverseEls (struct hash *hash, void(*func)(struct hashEl *hel))
void hashTraverseVals (struct hash *hash, void(*func)(void *val))
hashElhashElListHash (struct hash *hash)
int hashElCmp (const void *va, const void *vb)
void * hashElFindVal (struct hashEl *list, char *name)
void hashElFree (struct hashEl **pEl)
void hashElFreeList (struct hashEl **pList)
hashCookie hashFirst (struct hash *hash)
hashElhashNext (struct hashCookie *cookie)
void * hashNextVal (struct hashCookie *cookie)
char * hashNextName (struct hashCookie *cookie)
hashnewHash (int powerOfTwoSize)
hashhashFromSlNameList (void *list)
void freeHash (struct hash **pHash)
void freeHashAndVals (struct hash **pHash)
void hashFreeWithVals (struct hash **pHash, void(freeFunc)())
void hashFreeList (struct hash **pList)
void hashHisto (struct hash *hash, char *fname)
hashElhashReplace (struct hash *hash, char *name, void *val)
boolean hashMayRemove (struct hash *hash, char *name)
void hashMustRemove (struct hash *hash, char *name)
char * hashToRaString (struct hash *hash)


Define Documentation

#define hashFree (  )     freeHash(a)

Definition at line 159 of file hash.h.

Referenced by gfFileCacheFree(), hashFreeList(), hashFreeWithVals(), nibTwoCacheFree(), pcrClumps(), pslTblFree(), raFoldIn(), trixClose(), twoBitClose(), and xpFree().

#define hashMaxSize   24

Definition at line 28 of file hash.h.

#define hashNew (  )     newHash(a)

Definition at line 151 of file hash.h.

Referenced by buildSymHash(), chainReadUsedSwapLf(), dnaSeqHash(), faReadAllIntoHash(), gfFileCacheNew(), hashNameIntFile(), hashTwoColumnFile(), htmlHeaderRead(), initialEntityHash(), lineFileSetUniqueMetaData(), pscmOpen(), pslTblNew(), raFoldIn(), raReadAll(), and twoBitOpen().


Function Documentation

void freeHash ( struct hash **  pHash  ) 

Definition at line 462 of file hash.c.

References freez(), hash::lm, and lmCleanup().

Referenced by bigBlat(), blat(), cgiVarExcludeExcept(), checkTagIsInside(), dgFree(), formParseVars(), freeHashAndVals(), gfAlignTrans(), gfAlignTransTrans(), gffFileFree(), gfWebConfigRead(), maskFromOut(), metaDataFree(), and xStitch().

00464 {
00465 struct hash *hash = *pHash;
00466 if (hash == NULL)
00467     return;
00468 lmCleanup(&hash->lm);
00469 freez(pHash);
00470 }

Here is the call graph for this function:

Here is the caller graph for this function:

void freeHashAndVals ( struct hash **  pHash  ) 

Definition at line 473 of file hash.c.

References freeHash(), freeMem(), and hashTraverseVals().

Referenced by dtdParse(), emblOpen(), and htmlPageFree().

00476 {
00477 struct hash *hash;
00478 if ((hash = *pHash) != NULL)
00479     {
00480     hashTraverseVals(hash, freeMem);
00481     freeHash(pHash);
00482     }
00483 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashAdd ( struct hash hash,
char *  name,
void *  val 
) [read]

Definition at line 126 of file hash.c.

References hashAddN().

Referenced by addToBigBundleList(), blat(), bundleIntoTargets(), cgiVarExcludeExcept(), chainReadUsedSwapLf(), checkTagIsInside(), dgAddNode(), dgFindSubEdges(), emblRecord(), faReadAllIntoHash(), findOrMakeVar(), gffFileAddRow(), gfiExpandAndLoadCached(), gfWebConfigRead(), hashAddInt(), hashAddSaveName(), hashAddUnique(), hashFromSlNameList(), hashReplace(), hashStore(), hashStoreName(), hashTwoColumnFile(), hashVarLine(), hashWordsInFile(), htmlHeaderRead(), htmlPageParse(), initialEntityHash(), loadHashT3Ranges(), maskFromOut(), metaDataAdd(), netUrlHead(), nibInfoFromCache(), parseAnOption(), parseEntity(), parseGtfEnd(), parseMultiOption(), pcrClumps(), pscmSetHint(), raFoldIn(), raFoldInOneRetName(), raFromString(), raNextRecord(), raReadAll(), readPartHeaderMB(), readPslToBinKeeper(), trixSearchWordResults(), and xmlEscapeSymHash().

00128 {
00129 return hashAddN(hash, name, strlen(name), val);
00130 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashAddInt ( struct hash hash,
char *  name,
int  val 
) [read]

Definition at line 262 of file hash.c.

References hashAdd().

Referenced by buildSymHash(), and hashNameIntFile().

00264 {
00265 char *pt = NULL;
00266 return hashAdd(hash, name, pt + val);
00267 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashAddN ( struct hash hash,
char *  name,
int  nameSize,
void *  val 
) [read]

Definition at line 112 of file hash.c.

References hash::elCount, hashString(), hash::lm, lmAlloc(), hash::mask, and hash::table.

Referenced by hashAdd().

00114 {
00115 struct hashEl *el = lmAlloc(hash->lm, sizeof(*el));
00116 int hashVal = (hashString(name)&hash->mask);
00117 el->name = lmAlloc(hash->lm, nameSize+1);
00118 memcpy(el->name, name, nameSize);
00119 el->val = val;
00120 el->next = hash->table[hashVal];
00121 hash->table[hashVal] = el;
00122 hash->elCount += 1;
00123 return el;
00124 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashAddSaveName ( struct hash hash,
char *  name,
void *  val,
char **  saveName 
) [read]

Definition at line 173 of file hash.c.

References hashAdd(), and hashEl::name.

Referenced by cgiParseInputAbort(), cgiParseMultipart(), cgiVarSet(), parseCookies(), parseElement(), and twoBitOpen().

00175                                                                        :
00176  *    AllocVar(el);
00177  *    hashAddSaveName(hash, name, el, &el->name);
00178  */
00179 {
00180 struct hashEl *hel = hashAdd(hash, name, val);
00181 *saveName = hel->name;
00182 return hel;
00183 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashAddUnique ( struct hash hash,
char *  name,
void *  val 
) [read]

Definition at line 165 of file hash.c.

References errAbort(), hashAdd(), and hashLookup().

Referenced by dnaSeqHash(), and seqListToTrans3List().

00167 {
00168 if (hashLookup(hash, name) != NULL)
00169     errAbort("%s duplicated, aborting", name);
00170 return hashAdd(hash, name, val);
00171 }

Here is the call graph for this function:

Here is the caller graph for this function:

bits32 hashCrc ( char *  string  ) 

Definition at line 56 of file hash.c.

References bits32.

00058 {
00059 unsigned char *us = (unsigned char *)string;
00060 unsigned char c;
00061 bits32 shiftAcc = 0;
00062 bits32 addAcc = 0;
00063 
00064 while ((c = *us++) != 0)
00065     {
00066     shiftAcc <<= 2;
00067     shiftAcc += c;
00068     addAcc += c;
00069     }
00070 return shiftAcc + addAcc;
00071 }

int hashElCmp ( const void *  va,
const void *  vb 
)

Definition at line 346 of file hash.c.

References hashEl::name.

Referenced by hashToRaString().

00348 {
00349 const struct hashEl *a = *((struct hashEl **)va);
00350 const struct hashEl *b = *((struct hashEl **)vb);
00351 return strcmp(a->name, b->name);
00352 }

Here is the caller graph for this function:

void* hashElFindVal ( struct hashEl list,
char *  name 
)

Definition at line 354 of file hash.c.

References hashEl::name, hashEl::next, and hashEl::val.

00356 {
00357 struct hashEl *el;
00358 for (el = list; el != NULL; el = el->next)
00359     {
00360     if (strcmp(el->name, name) == 0)
00361         return el->val;
00362     }
00363 return NULL;
00364 }

void hashElFree ( struct hashEl **  pEl  ) 

Definition at line 383 of file hash.c.

References freez().

00386 {
00387 freez(pEl);
00388 }

Here is the call graph for this function:

void hashElFreeList ( struct hashEl **  pList  ) 

Definition at line 390 of file hash.c.

References slFreeList().

Referenced by cgiVarExcludeExcept(), hashToRaString(), nibTwoCacheFree(), and pcrClumps().

00393 {
00394 slFreeList(pList);
00395 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashElListHash ( struct hash hash  )  [read]

Definition at line 366 of file hash.c.

References CloneVar, hashEl::next, hash::size, slAddHead, and hash::table.

Referenced by cgiVarExcludeExcept(), hashToRaString(), nibTwoCacheFree(), and pcrClumps().

00368 {
00369 int i;
00370 struct hashEl *hel, *dupe, *list = NULL;
00371 for (i=0; i<hash->size; ++i)
00372     {
00373     for (hel = hash->table[i]; hel != NULL; hel = hel->next)
00374         {
00375         dupe = CloneVar(hel);
00376         slAddHead(&list, dupe);
00377         }
00378     }
00379 return list;
00380 }

Here is the caller graph for this function:

void* hashFindVal ( struct hash hash,
char *  name 
)

Definition at line 233 of file hash.c.

References hashLookup(), and hashEl::val.

Referenced by addToBigBundleList(), bundleIntoTargets(), cgiParseMultipart(), emblOpen(), expandEntities(), findCookieData(), findOrMakeVar(), findVarData(), fixupChildRefs(), gfiExpandAndLoadCached(), htmlPageForwarded(), htmlPageParse(), htmlPageValidateOrAbort(), loadHashT3Ranges(), mafMayFindComponentInHash(), maskFromOut(), nibInfoFromCache(), optGet(), optionMultiVal(), parseAttribute(), parseElement(), parseEntity(), parseMultiOption(), parseMultiParts(), pcrClumps(), raFoldInOneRetName(), raReadAll(), trans3Find(), trixSearchWordResults(), twoBitSeekTo(), and xpLookup().

00235 {
00236 struct hashEl *hel = hashLookup(hash, name);
00237 if (hel == NULL)
00238     return NULL;
00239 return hel->val;
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashCookie hashFirst ( struct hash hash  )  [read]

Definition at line 397 of file hash.c.

References hashCookie::hash, hash::size, and hash::table.

Referenced by hashFreeWithVals(), and mafMayFindAllComponents().

00400 {
00401 struct hashCookie cookie;
00402 cookie.hash = hash;
00403 cookie.idx = 0;
00404 cookie.nextEl = NULL;
00405 
00406 /* find first entry */
00407 for (cookie.idx = 0;
00408      (cookie.idx < hash->size) && (hash->table[cookie.idx] == NULL);
00409      cookie.idx++)
00410     continue;  /* empty body */
00411 if (cookie.idx < hash->size)
00412     cookie.nextEl = hash->table[cookie.idx];
00413 return cookie;
00414 }

Here is the caller graph for this function:

void hashFreeList ( struct hash **  pList  ) 

Definition at line 501 of file hash.c.

References hashFree, and hash::next.

00503 {
00504 struct hash *el, *next;
00505 
00506 for (el = *pList; el != NULL; el = next)
00507     {
00508     next = el->next;
00509     hashFree(&el);
00510     }
00511 *pList = NULL;
00512 }

void hashFreeWithVals ( struct hash **  pHash,
void(freeFunc)()   
)

Definition at line 485 of file hash.c.

References hashCookie::hash, hashFirst(), hashFree, hashNext(), and hashEl::val.

00489 {
00490 struct hash *hash = *pHash;
00491 if (hash != NULL)
00492     {
00493     struct hashCookie cookie = hashFirst(hash);
00494     struct hashEl *hel;
00495     while ((hel = hashNext(&cookie)) != NULL)
00496         freeFunc(&hel->val);
00497     hashFree(pHash);
00498     }
00499 }

Here is the call graph for this function:

struct hash* hashFromSlNameList ( void *  list  )  [read]

Definition at line 308 of file hash.c.

References hashAdd(), newHash(), and slName::next.

00311 {
00312 struct hash *hash = NULL;
00313 struct slName *namedList = list, *item;
00314 if (!list)
00315     return NULL;
00316 hash = newHash(0);
00317 for (item = namedList; item != NULL; item = item->next)
00318     hashAdd(hash, item->name, item);
00319 return hash;
00320 }

Here is the call graph for this function:

void hashHisto ( struct hash hash,
char *  fname 
)

Definition at line 523 of file hash.c.

References bucketLen(), carefulClose(), mustOpen(), hash::size, and hash::table.

00525 {
00526 FILE* fh = mustOpen(fname, "w");
00527 int i;
00528 
00529 for (i=0; i<hash->size; ++i)
00530     fprintf(fh, "%d\n", bucketLen(hash->table[i]));
00531 carefulClose(&fh);
00532 }

Here is the call graph for this function:

long long hashIntSum ( struct hash hash  ) 

Definition at line 269 of file hash.c.

References hashEl::next, ptToInt(), hash::size, hash::table, and hashEl::val.

00271 {
00272 long long sum = 0;
00273 int i;
00274 struct hashEl *hel;
00275 for (i=0; i<hash->size; ++i)
00276     {
00277     for (hel = hash->table[i]; hel != NULL; hel = hel->next)
00278         {
00279         int num = ptToInt(hel->val);
00280         sum += (long long)num;
00281         }
00282     }
00283 return sum;
00284 }

Here is the call graph for this function:

int hashIntVal ( struct hash hash,
char *  name 
)

Definition at line 207 of file hash.c.

References hashMustFindVal(), ptToInt(), and hashEl::val.

Referenced by sqlEnumParse(), and sqlSetParse().

00209 {
00210 void *val = hashMustFindVal(hash, name);
00211 return ptToInt(val);
00212 }

Here is the call graph for this function:

Here is the caller graph for this function:

int hashIntValDefault ( struct hash hash,
char *  name,
int  defaultInt 
)

Definition at line 214 of file hash.c.

References hashLookup(), ptToInt(), and hashEl::val.

00217 {
00218 struct hashEl *hel = hashLookup(hash, name);
00219 if(hel == NULL)
00220     return defaultInt;
00221 return ptToInt(hel->val);
00222 }

Here is the call graph for this function:

struct hashEl* hashLookup ( struct hash hash,
char *  name 
) [read]

Definition at line 73 of file hash.c.

References hashString(), hash::mask, hashEl::name, hashEl::next, and hash::table.

Referenced by cgiStringList(), cgiVarExcludeExcept(), cgiVarExists(), chainReadUsedSwapLf(), checkTagIsInside(), dgAddNode(), dgFindNode(), dgFindSubEdges(), faReadAllIntoHash(), gffFileAddRow(), gffGroupLines(), gfWebConfigRead(), hashAddUnique(), hashFindVal(), hashIntValDefault(), hashLookupUpperCase(), hashMustFindName(), hashMustFindVal(), hashOptionalVal(), hashReplace(), hashStore(), hashStoreName(), metaDataAdd(), parseEntity(), parseGtfEnd(), pscmSetHint(), raFoldIn(), raFoldInOneRetName(), and readPslToBinKeeper().

00076 {
00077 struct hashEl *el = hash->table[hashString(name)&hash->mask];
00078 while (el != NULL)
00079     {
00080     if (strcmp(el->name, name) == 0)
00081         break;
00082     el = el->next;
00083     }
00084 return el;
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashLookupNext ( struct hashEl hashEl  )  [read]

Definition at line 98 of file hash.c.

References hashEl::name, and hashEl::next.

00101 {
00102 struct hashEl *el = hashEl->next;
00103 while (el != NULL)
00104     {
00105     if (strcmp(el->name, hashEl->name) == 0)
00106         break;
00107     el = el->next;
00108     }
00109 return el;
00110 }

struct hashEl* hashLookupUpperCase ( struct hash hash,
char *  name 
) [read]

Definition at line 87 of file hash.c.

References hashLookup(), safef(), and touppers().

00090 {
00091 char s[256];
00092 safef(s, sizeof(s), "%s", name);
00093 touppers(s);
00094 return hashLookup(hash, s);
00095 }

Here is the call graph for this function:

boolean hashMayRemove ( struct hash hash,
char *  name 
)

Definition at line 132 of file hash.c.

References hashRemove().

00135 {
00136 return (hashRemove(hash, name) != NULL);
00137 }

Here is the call graph for this function:

char* hashMustFindName ( struct hash hash,
char *  name 
)

Definition at line 252 of file hash.c.

References errAbort(), hashLookup(), and hashEl::name.

00255 {
00256 struct hashEl *hel = hashLookup(hash, name);
00257 if (hel == NULL)
00258     errAbort("%s not found", name);
00259 return hel->name;
00260 }

Here is the call graph for this function:

void* hashMustFindVal ( struct hash hash,
char *  name 
)

Definition at line 224 of file hash.c.

References errAbort(), hashLookup(), and hashEl::val.

Referenced by chainLookup(), gfAlignTrans(), gfFindAlignAaTrans(), hashIntVal(), readPslToBinKeeper(), saveAlignments(), saveAxtBundle(), and savePslx().

00226 {
00227 struct hashEl *hel = hashLookup(hash, name);
00228 if (hel == NULL)
00229     errAbort("%s not found", name);
00230 return hel->val;
00231 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hashMustRemove ( struct hash hash,
char *  name 
)

Definition at line 139 of file hash.c.

References errAbort(), and hashRemove().

00142 {
00143 if (hashRemove(hash, name) == NULL)
00144     errAbort("attempt to remove non-existant %s from hash", name);
00145 }

Here is the call graph for this function:

struct hashEl* hashNext ( struct hashCookie cookie  )  [read]

Definition at line 416 of file hash.c.

References hashCookie::hash, hashCookie::idx, hashEl::next, hashCookie::nextEl, hash::size, and hash::table.

Referenced by hashFreeWithVals(), hashNextName(), hashNextVal(), and mafMayFindAllComponents().

00419 {
00420 /* NOTE: if hashRemove were coded to track the previous entry during the
00421  * search and then use it to do the remove, it would be possible to
00422  * remove the entry returned by this method */
00423 struct hashEl *retEl = cookie->nextEl;
00424 if (retEl == NULL)
00425     return NULL;  /* no more */
00426 
00427 /* find next entry */
00428 cookie->nextEl = retEl->next;
00429 if (cookie->nextEl == NULL)
00430     {
00431     for (cookie->idx++; (cookie->idx < cookie->hash->size)
00432              && (cookie->hash->table[cookie->idx] == NULL); cookie->idx++)
00433         continue;  /* empty body */
00434     if (cookie->idx < cookie->hash->size)
00435         cookie->nextEl = cookie->hash->table[cookie->idx];
00436     }
00437 return retEl;
00438 }

Here is the caller graph for this function:

char* hashNextName ( struct hashCookie cookie  ) 

Definition at line 451 of file hash.c.

References hashNext(), and hashEl::name.

00454 {
00455 struct hashEl *hel = hashNext(cookie);
00456 if (hel == NULL)
00457     return NULL;
00458 else
00459     return hel->name;
00460 }

Here is the call graph for this function:

void* hashNextVal ( struct hashCookie cookie  ) 

Definition at line 440 of file hash.c.

References hashNext(), and hashEl::val.

00443 {
00444 struct hashEl *hel = hashNext(cookie);
00445 if (hel == NULL)
00446     return NULL;
00447 else
00448     return hel->val;
00449 }

Here is the call graph for this function:

void* hashOptionalVal ( struct hash hash,
char *  name,
void *  usual 
)

Definition at line 242 of file hash.c.

References hashLookup(), and hashEl::val.

Referenced by pscmGetHint().

00244 {
00245 struct hashEl *hel = hashLookup(hash, name);
00246 if (hel == NULL)
00247     return usual;
00248 else
00249     return hel->val;
00250 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* hashRemove ( struct hash hash,
char *  name 
)

Definition at line 147 of file hash.c.

References hash::elCount, hashString(), hash::mask, hashEl::name, hashEl::next, sameString, slRemoveEl(), hash::table, and hashEl::val.

Referenced by cgiVarExclude(), hashMayRemove(), hashMustRemove(), hashReplace(), and pscmSetHint().

00150 {
00151 struct hashEl *hel;
00152 void *ret;
00153 struct hashEl **pBucket = &hash->table[hashString(name)&hash->mask];
00154 for (hel = *pBucket; hel != NULL; hel = hel->next)
00155     if (sameString(hel->name, name))
00156         break;
00157 if (hel == NULL)
00158     return NULL;
00159 ret = hel->val;
00160 if (slRemoveEl(pBucket, hel))
00161     hash->elCount -= 1;
00162 return ret;
00163 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hashEl* hashReplace ( struct hash hash,
char *  name,
void *  val 
) [read]

Definition at line 534 of file hash.c.

References hashAdd(), hashLookup(), and hashRemove().

00536 {
00537 if (hashLookup(hash, name))
00538     hashRemove(hash, name);
00539 return hashAdd(hash, name, val);
00540 }

Here is the call graph for this function:

struct hashEl* hashStore ( struct hash hash,
char *  name 
) [read]

Definition at line 185 of file hash.c.

References hashAdd(), and hashLookup().

Referenced by pslQueryGet().

00188 {
00189 struct hashEl *hel;
00190 if ((hel = hashLookup(hash, name)) != NULL)
00191     return hel;
00192 return hashAdd(hash, name, NULL);
00193 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* hashStoreName ( struct hash hash,
char *  name 
)

Definition at line 195 of file hash.c.

References hashAdd(), hashLookup(), and hashEl::name.

Referenced by xStitch().

00198 {
00199 struct hashEl *hel;
00200 if (name == NULL)
00201     return NULL;
00202 if ((hel = hashLookup(hash, name)) != NULL)
00203     return hel->name;
00204 return hashAdd(hash, name, NULL)->name;
00205 }

Here is the call graph for this function:

Here is the caller graph for this function:

bits32 hashString ( char *  string  ) 

Definition at line 42 of file hash.c.

Referenced by hashAddN(), hashLookup(), and hashRemove().

00044 {
00045 char *keyStr = string;
00046 unsigned int result = 0;
00047 int c;
00048 
00049 while ((c = *keyStr++) != '\0')
00050     {
00051     result += (result<<3) + c;
00052     }
00053 return result;
00054 }

Here is the caller graph for this function:

char* hashToRaString ( struct hash hash  ) 

Definition at line 542 of file hash.c.

References dyStringAppend(), dyStringAppendC(), dyStringCannibalize(), dyStringNew, hashElCmp(), hashElFreeList(), hashElListHash(), hashEl::name, hashEl::next, slSort(), and hashEl::val.

00544 {
00545 struct hashEl *el, *list = hashElListHash(hash);
00546 struct dyString *dy = dyStringNew(0);
00547 slSort(&list, hashElCmp);
00548 for (el = list; el != NULL; el = el->next)
00549    {
00550    dyStringAppend(dy, el->name);
00551    dyStringAppendC(dy, ' ');
00552    dyStringAppend(dy, el->val);
00553    dyStringAppendC(dy, '\n');
00554    }
00555 hashElFreeList(&list);
00556 return dyStringCannibalize(&dy);
00557 }

Here is the call graph for this function:

void hashTraverseEls ( struct hash hash,
void(*)(struct hashEl *hel)  func 
)

Definition at line 322 of file hash.c.

References hashEl::next, hash::size, and hash::table.

Referenced by gfFileCacheFree().

00324 {
00325 int i;
00326 struct hashEl *hel;
00327 for (i=0; i<hash->size; ++i)
00328     {
00329     for (hel = hash->table[i]; hel != NULL; hel = hel->next)
00330         func(hel);
00331     }
00332 }

Here is the caller graph for this function:

void hashTraverseVals ( struct hash hash,
void(*)(void *val)  func 
)

Definition at line 334 of file hash.c.

References hashEl::next, hash::size, hash::table, and hashEl::val.

Referenced by freeHashAndVals(), and trixClose().

00336 {
00337 int i;
00338 struct hashEl *hel;
00339 for (i=0; i<hash->size; ++i)
00340     {
00341     for (hel = hash->table[i]; hel != NULL; hel = hel->next)
00342         func(hel->val);
00343     }
00344 }

Here is the caller graph for this function:

struct hash* newHash ( int  powerOfTwoSize  )  [read]

Definition at line 286 of file hash.c.

References lmAlloc(), lmInit(), and needMem().

Referenced by blat(), bundleIntoTargets(), cgiParseInputAbort(), cgiParseMultipart(), cgiVarExcludeExcept(), checkTagIsInside(), dgFindSubEdges(), dgNew(), dtdParse(), emblRecord(), formParseVars(), gffFileNew(), gfLongDnaInMem(), gfLongTransTransInMem(), gfWebConfigRead(), hashFromSlNameList(), hashVarLine(), hashWordsInFile(), loadHashT3Ranges(), maskFromOut(), nibTwoCacheNew(), parseCookies(), parseOptions(), pcrClumps(), raFoldInOneRetName(), raFromString(), raNextRecord(), readPartHeaderMB(), readPslToBinKeeper(), seqListToTrans3List(), trixNew(), xmlEscapeSymHash(), and xStitch().

00288 {
00289 struct hash *hash = needMem(sizeof(*hash));
00290 int memBlockPower = 16;
00291 if (powerOfTwoSize == 0)
00292     powerOfTwoSize = 12;
00293 assert(powerOfTwoSize <= hashMaxSize && powerOfTwoSize > 0);
00294 hash->powerOfTwoSize = powerOfTwoSize;
00295 hash->size = (1<<powerOfTwoSize);
00296 /* Make size of memory block for allocator vary between
00297  * 256 bytes and 64k depending on size of table. */
00298 if (powerOfTwoSize < 8)
00299     memBlockPower = 8;
00300 else if (powerOfTwoSize < 16)
00301     memBlockPower = powerOfTwoSize;
00302 hash->lm = lmInit(1<<memBlockPower);
00303 hash->mask = hash->size-1;
00304 hash->table = lmAlloc(hash->lm, sizeof(struct hashEl *) * hash->size);
00305 return hash;
00306 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 19:00:15 2007 for blat by  doxygen 1.5.2