d75210efe63eb3a25e5b53ee0aa3f96293ceeb88 angie Mon Feb 25 14:32:38 2013 -0800 Libified asColumnFindIx. (#6152) diff --git src/hg/lib/annoStreamDb.c src/hg/lib/annoStreamDb.c index 3bdca0a..64538a7 100644 --- src/hg/lib/annoStreamDb.c +++ src/hg/lib/annoStreamDb.c @@ -102,42 +102,30 @@ } static void asdClose(struct annoStreamer **pVSelf) /* Close db connection and free self. */ { if (pVSelf == NULL) return; struct annoStreamDb *self = *(struct annoStreamDb **)pVSelf; // Let the caller close conn; it might be from a cache. freeMem(self->table); sqlFreeResult(&(self->sr)); hFreeConn(&(self->conn)); annoStreamerFree(pVSelf); } -static int asColumnFindIx(struct asColumn *list, char *string) -/* Return index of first element of asColumn list that matches string. - * Return -1 if not found. */ -{ -struct asColumn *ac; -int ix = 0; -for (ac = list; ac != NULL; ac = ac->next, ix++) - if (sameString(string, ac->name)) - return ix; -return -1; -} - static boolean asHasFields(struct annoStreamDb *self, char *chromField, char *startField, char *endField) /* If autoSql def has all three columns, remember their names and column indexes and * return TRUE. */ { struct asColumn *columns = self->streamer.asObj->columnList; int chromIx = asColumnFindIx(columns, chromField); int startIx = asColumnFindIx(columns, startField); int endIx = asColumnFindIx(columns, endField); if (chromIx >= 0 && startIx >= 0 && endIx >= 0) { self->chromField = cloneString(chromField); self->startField = cloneString(startField); self->endField = cloneString(endField); self->chromIx = chromIx;