bc5a73ec376d9d06861b8d07e7abfe615fc38501 angie Wed Apr 10 09:39:10 2019 -0700 Added hashIntReset, to quickly remove & reset to 0 all integer values of a hash. [It can also NULL out hashEl pointers, but mem alloc issues should be considered] diff --git src/inc/hash.h src/inc/hash.h index 3867acb..4b690dc 100644 --- src/inc/hash.h +++ src/inc/hash.h @@ -166,30 +166,33 @@ void hashIncInt(struct hash *hash, char *name); /* Increment integer value in hash */ int hashIntVal(struct hash *hash, char *name); /* Return integer value associated with name in a simple * hash of ints. */ int hashIntValDefault(struct hash *hash, char *name, int defaultInt); /* Return integer value associated with name in a simple * hash of ints or defaultInt if not found. */ long long hashIntSum(struct hash *hash); /* Return sum of all the ints in a hash of ints. */ +void hashIntReset(struct hash *hash); +/* Reset all values in hash of ints to 0. Reset element count to 0. */ + void hashTraverseEls(struct hash *hash, void (*func)(struct hashEl *hel)); /* Apply func to every element of hash with hashEl as parameter. */ void hashTraverseVals(struct hash *hash, void (*func)(void *val)); /* Apply func to every element of hash with hashEl->val as parameter. */ struct hashEl *hashElListHash(struct hash *hash); /* Return a list of all elements of hash. Free return with hashElFreeList. */ int hashElCmp(const void *va, const void *vb); /* Compare two hashEl by name. */ int hashElCmpWithEmbeddedNumbers(const void *va, const void *vb); /* Compare two hashEl by name sorting including numbers within name, * suitable for chromosomes, genes, etc. */