src/lib/hash.c 1.49
1.49 2009/04/30 18:12:00 mikep
expanding message which lead to a bug somewhere else
Index: src/lib/hash.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/hash.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -b -B -U 4 -r1.48 -r1.49
--- src/lib/hash.c 6 Oct 2008 17:04:17 -0000 1.48
+++ src/lib/hash.c 30 Apr 2009 18:12:00 -0000 1.49
@@ -210,9 +210,13 @@
struct hashEl *hashAddSaveName(struct hash *hash, char *name, void *val, char **saveName)
/* Add new element to hash table. Save the name of the element, which is now
* allocated in the hash table, to *saveName. A typical usage would be:
* AllocVar(el);
- * hashAddSaveName(hash, name, el, &el->name);
+ * el->val = someVal;
+ * hashAddSaveName(hash, name, el->val, &el->name);
+ * Note this above code gives you a hashEl 'el' which is not in the hash, but
+ * whose ->name and ->val pointers are the same as the pionters of
+ * the hashEl in the hash.
*/
{
struct hashEl *hel = hashAdd(hash, name, val);
*saveName = hel->name;