affab5cdcf3b4a5f9d3eb91f2f25a55afc465fb6 angie Wed Apr 8 15:50:49 2015 -0700 Libifying trackDbCmpShortLabel so I can use it elsewhere. diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c index 6fa012ea..bfe8c10 100644 --- src/hg/lib/trackDbCustom.c +++ src/hg/lib/trackDbCustom.c @@ -35,30 +35,38 @@ int trackDbCmp(const void *va, const void *vb) /* Compare to sort based on priority; use shortLabel as secondary sort key. * Note: parallel code to hgTracks.c:tgCmpPriority */ { const struct trackDb *a = *((struct trackDb **)va); const struct trackDb *b = *((struct trackDb **)vb); float dif = a->priority - b->priority; if (dif < 0) return -1; else if (dif == 0.0) return strcasecmp(a->shortLabel, b->shortLabel); else return 1; } +int trackDbCmpShortLabel(const void *va, const void *vb) +/* Sort track by shortLabel. */ +{ +const struct trackDb *a = *((struct trackDb **)va); +const struct trackDb *b = *((struct trackDb **)vb); +return strcmp(a->shortLabel, b->shortLabel); +} + void parseColor(char *text, unsigned char *r, unsigned char *g, unsigned char *b) /* Turn comma-separated string of three numbers into three * color components. */ { char dupe[64]; safecpy(dupe, sizeof(dupe), text); char *words[4]; int wordCount; wordCount = chopString(dupe, ", \t", words, ArraySize(words)); if (wordCount != 3) errAbort("Expecting 3 comma separated values in %s.", text); *r = atoi(words[0]); *g = atoi(words[1]); *b = atoi(words[2]); }