f970f8e2fd81d08901048b2070054dd71ed7f1f1 angie Tue Apr 9 11:47:57 2013 -0700 Use localmem for annoRow storage, instead of many independent malloc & free calls. refs #6152 diff --git src/lib/annoStreamVcf.c src/lib/annoStreamVcf.c index 2d28e8a..bb7df09 100644 --- src/lib/annoStreamVcf.c +++ src/lib/annoStreamVcf.c @@ -62,50 +62,50 @@ if (i > 0) dyStringAppendC(self->dyGt, '\t'); dyStringAppend(self->dyGt, words[9+i]); } self->asWords[9] = self->dyGt->string; } else { self->asWords[8] = ""; self->asWords[9] = ""; } self->record = vcfRecordFromRow(self->vcff, words); return self->asWords; } -static struct annoRow *asvNextRow(struct annoStreamer *vSelf) +static struct annoRow *asvNextRow(struct annoStreamer *vSelf, struct lm *callerLm) /* Return an annoRow encoding the next VCF record, or NULL if there are no more items. */ { struct annoStreamVcf *self = (struct annoStreamVcf *)vSelf; char **words = nextRowUnfiltered(self); if (words == NULL) return NULL; // Skip past any left-join failures until we get a right-join failure, a passing row, or EOF. boolean rightFail = FALSE; while (annoFilterRowFails(vSelf->filters, words, self->numCols, &rightFail)) { if (rightFail) break; words = nextRowUnfiltered(self); if (words == NULL) return NULL; } struct vcfRecord *rec = self->record; return annoRowFromStringArray(rec->chrom, rec->chromStart, rec->chromEnd, - rightFail, words, self->numCols); + rightFail, words, self->numCols, callerLm); } static void asvClose(struct annoStreamer **pVSelf) /* Close VCF file and free self. */ { if (pVSelf == NULL) return; struct annoStreamVcf *self = *(struct annoStreamVcf **)pVSelf; vcfFileFree(&(self->vcff)); // Don't free self->record -- currently it belongs to vcff's localMem dyStringFree(&(self->dyGt)); annoStreamerFree(pVSelf); } struct annoStreamer *annoStreamVcfNew(char *fileOrUrl, boolean isTabix, int maxRecords)