660ea9ebd6b1d24a991fc5a5013fd4f4f0b74fb2
tdreszer
  Fri Oct 29 13:51:47 2010 -0700
Added sorting routines for slPairs when the val is a string.  Will be used by cv terms whitelist
diff --git src/lib/common.c src/lib/common.c
index 26336ef..54a1a83 100644
--- src/lib/common.c
+++ src/lib/common.c
@@ -990,30 +990,59 @@
 void slPairSortCase(struct slPair **pList)
 /* Sort slPair list, ignore case. */
 {
 slSort(pList, slPairCmpCase);
 }
 
 int slPairCmp(const void *va, const void *vb)
 /* Compare two slPairs. */
 {
 const struct slPair *a = *((struct slPair **)va);
 const struct slPair *b = *((struct slPair **)vb);
 return strcmp(a->name, b->name);
 }
 
 
+int slPairValCmpCase(const void *va, const void *vb)
+/* Case insensitive compare two slPairs on their values (must be string). */
+{
+const struct slPair *a = *((struct slPair **)va);
+const struct slPair *b = *((struct slPair **)vb);
+return strcmp((char *)(a->val), (char *)(b->val));
+}
+
+int slPairValCmp(const void *va, const void *vb)
+/* Compare two slPairs on their values (must be string). */
+{
+const struct slPair *a = *((struct slPair **)va);
+const struct slPair *b = *((struct slPair **)vb);
+return strcmp((char *)(a->val), (char *)(b->val));
+}
+
+void slPairValSortCase(struct slPair **pList)
+/* Sort slPair list on values (must be string), ignore case. */
+{
+slSort(pList, slPairValCmpCase);
+}
+
+void slPairValSort(struct slPair **pList)
+/* Sort slPair list on values (must be string). */
+{
+slSort(pList, slPairValCmp);
+}
+
+
 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++);
     c2 = toupper(*s2++);