18828a18df54aed6e127251ebd6e5651e8af18cc
larrym
  Tue Nov 29 10:36:16 2011 -0800
cache NULLs in cvTermHash to avoid repeated lookups (part of attempt to speedup hgFileUi)
diff --git src/hg/lib/cv.c src/hg/lib/cv.c
index f696201..e27c88d 100644
--- src/hg/lib/cv.c
+++ src/hg/lib/cv.c
@@ -105,38 +105,41 @@
 }
 
 const struct hash *cvTermHash(const char *term)
 // returns a hash of hashes of a term which should be defined in cv.ra
 // NOTE: in static memory: DO NOT FREE
 {
 static struct hash *cvHashOfHashOfHashes = NULL;
 if (sameString(term,CV_TERM_CELL))
     term = CV_UGLY_TERM_CELL_LINE;
 else if (sameString(term,CV_TERM_ANTIBODY))
     term = CV_UGLY_TERM_ANTIBODY;
 
 if (cvHashOfHashOfHashes == NULL)
     cvHashOfHashOfHashes = hashNew(9);
 
-struct hash *cvHashForTerm = hashFindVal(cvHashOfHashOfHashes,(char *)term);
+struct hashEl *hel = hashLookup(cvHashOfHashOfHashes, (char *) term);
+struct hash *cvHashForTerm = NULL;
+
 // Establish cv hash of Term Types if it doesn't already exist
-if (cvHashForTerm == NULL)
+if (hel == NULL)
     {
     cvHashForTerm = raReadWithFilter((char *)cvFile(), CV_TERM,CV_TYPE,(char *)term);
-    if (cvHashForTerm != NULL)
         hashAdd(cvHashOfHashOfHashes,(char *)term,cvHashForTerm);
     }
+else
+    cvHashForTerm = hel->val;
 
 return cvHashForTerm;
 }
 
 const struct hash *cvOneTermHash(const char *type,const char *term)
 // returns a hash for a single term of a given type
 // NOTE: in static memory: DO NOT FREE
 {
 const struct hash *typeHash = cvTermHash(type);
 if (typeHash != NULL)
     return hashFindVal((struct hash *)typeHash,(char *)term);
 return NULL;
 }
 
 const struct hash *cvTermTypeHash()