cadb863ddfbcc1f97b04f0d0b8ef73db862dd060 tdreszer Thu Jul 28 16:32:04 2011 -0700 Fixed some hash sizes, moved some validation code from mdb.c to cv.c, added numeric sort of hgFileUi filerBy and track/file search of terms defined in cv validation as integer. diff --git src/lib/common.c src/lib/common.c index 38c354b..958fae0 100644 --- src/lib/common.c +++ src/lib/common.c @@ -1250,30 +1250,43 @@ int slPairIntCmp(const void *va, const void *vb) // Compare two slPairs on their integer values. { const struct slPair *a = *((struct slPair **)va); const struct slPair *b = *((struct slPair **)vb); return ((char *)(a->val) - (char *)(b->val)); // cast works and val is 0 vased integer } void slPairIntSort(struct slPair **pList) // Sort slPair list on integer values. { slSort(pList, slPairIntCmp); } +int slPairAtoiCmp(const void *va, const void *vb) +// Compare two slPairs on their strings interpreted as integer values. +{ +const struct slPair *a = *((struct slPair **)va); +const struct slPair *b = *((struct slPair **)vb); +return (atoi((char *)(a->val)) - atoi((char *)(b->val))); +} + +void slPairValAtoiSort(struct slPair **pList) +// Sort slPair list on string values interpreted as integers. +{ +slSort(pList, slPairAtoiCmp); +} void gentleFree(void *pt) { if (pt != NULL) freeMem((char*)pt); } int differentWord(char *s1, char *s2) /* strcmp ignoring case - returns zero if strings are * the same (ignoring case) otherwise returns difference * between first non-matching characters. */ { char c1, c2; for (;;) { c1 = toupper(*s1++);