d75210efe63eb3a25e5b53ee0aa3f96293ceeb88 angie Mon Feb 25 14:32:38 2013 -0800 Libified asColumnFindIx. (#6152) diff --git src/lib/asParse.c src/lib/asParse.c index 7e69e1f..516dd70 100644 --- src/lib/asParse.c +++ src/lib/asParse.c @@ -451,30 +451,42 @@ } struct asColumn *asColumnFind(struct asObject *asObj, char *name) // Return named column. { struct asColumn *asCol = NULL; if (asObj!= NULL) { for (asCol = asObj->columnList; asCol != NULL; asCol = asCol->next) if (sameString(asCol->name, name)) break; } return asCol; } +int asColumnFindIx(struct asColumn *list, char *name) +/* Return index of first element of asColumn list that matches name. + * Return -1 if not found. */ +{ +struct asColumn *ac; +int ix = 0; +for (ac = list; ac != NULL; ac = ac->next, ix++) + if (sameString(name, ac->name)) + return ix; +return -1; +} + boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck, int *retNumColumnsSame, boolean abortOnDifference) /* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type. * If difference found, print it to stderr. If abortOnDifference, errAbort. * Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields. * If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */ { boolean differencesFound = FALSE; struct asColumn *col1 = as1->columnList, *col2 = as2->columnList; int checkCount = 0; int verboseLevel = 2; if (abortOnDifference) verboseLevel = 1; if (as1->isTable != as2->isTable) {