499eb9facae2cd13591dad0256751b9742aa1bea angie Thu Aug 17 09:52:36 2017 -0700 Added asColumnMustFindIx. Use it in hgVai in places where columns are expected to never go away, instead of risking that they do go away and we access row[-1]. Thx Jonathan. refs #19992 note-13 diff --git src/inc/asParse.h src/inc/asParse.h index 140de20..55429e6 100644 --- src/inc/asParse.h +++ src/inc/asParse.h @@ -116,30 +116,34 @@ /* free a list of asObject */ void asColumnFree(struct asColumn **as); /* free a single asColumn */ void asColumnFreeList(struct asColumn **as); /* free a list of asColumn */ struct asColumn *asColumnFind(struct asObject *as, char *name); /* Return column of given name from object, or NULL if not found. */ int asColumnFindIx(struct asColumn *list, char *name); /* Return index of first element of asColumn list that matches name. * Return -1 if not found. */ +int asColumnMustFindIx(struct asColumn *list, char *name); +/* Return index of first element of asColumn list that matches name. + * errAbort if not found. */ + 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. */ INLINE boolean asObjectsMatch(struct asObject *as1, struct asObject *as2) { int colCount = slCount(as1->columnList); if (slCount(as2->columnList) != colCount) return FALSE; return asCompareObjs(as1->name, as1, as2->name, as2, colCount, NULL, FALSE); }