static void printColumns(struct annoFormatTab *self, struct annoStreamer *streamer, struct annoRow *row, boolean isFirst) /* Print columns in streamer's row (if NULL, print the right number of empty fields). */ { FILE *f = self->f; char *sourceName = streamer->name; boolean freeWhenDone = FALSE; char **words = wordsFromRow(row, streamer, &freeWhenDone); struct asColumn *col; int i; for (col = streamer->asObj->columnList, i = 0; col != NULL; col = col->next, i++) { if (columnIsIncluded(self, sourceName, col->name)) { if (isFirst) isFirst = FALSE; else fputc('\t', f); if (words != NULL) fputs((words[i] ? words[i] : ""), f); } } int wordCount = i; if (freeWhenDone) { for (i = 0; i < wordCount; i++) freeMem(words[i]); freeMem(words); } }
static void printColumns(FILE *f, struct annoStreamer *streamer, struct annoRow *row, boolean isFirst) /* Print columns in streamer's row (if NULL, print the right number of empty fields). */ { boolean freeWhenDone = FALSE; char **words = wordsFromRow(row, streamer, &freeWhenDone); if (streamer->rowType == arWig) { // Fudge in the row's chrom, start, end as output columns even though they're not in autoSql if (isFirst) { if (row != NULL) fputs(row->chrom, f); isFirst = FALSE; } if (row != NULL) fprintf(f, "\t%u\t%u", row->start, row->end); else fputs("\t\t", f); } int colCount = slCount(streamer->asObj->columnList); int i; for (i = 0; i < colCount; i++) { if (!isFirst || i > 0) fputc('\t', f); if (words != NULL) fputs((words[i] ? words[i] : ""), f); } if (freeWhenDone) { freeMem(words[0]); freeMem(words); } }