MCPcopy Create free account
hub / github.com/GregoryFaust/samblaster / splitSplitLine

Function splitSplitLine

samblaster.cpp:234–255  ·  view source on GitHub ↗

Split the line into fields.

Source from the content-addressed store, hash-verified

232
233// Split the line into fields.
234void splitSplitLine(splitLine_t * line, int maxSplits)
235{
236 line->numFields = 0;
237 int fieldStart = 0;
238 // replace the newline with a tab so that it works like the rest of the fields.
239 line->buffer[line->bufLen-1] = '\t';
240 for (int i=0; i<line->bufLen; ++i)
241 {
242 if (line->buffer[i] == '\t')
243 {
244 line->fields[line->numFields] = line->buffer + fieldStart;
245 line->numFields += 1;
246 if (line->numFields == maxSplits) break;
247 line->buffer[i] = 0;
248 // Get ready for the next iteration.
249 fieldStart = i+1;
250 }
251 }
252 // replace the tab at the end of the line with a null char to terminate the final string.
253 line->buffer[line->bufLen-1] = 0;
254 line->split = true;
255}
256
257// Unsplit the fields back into a single string.
258// This will mung the strings, so only call this when all processing on the line is done.

Callers 3

resizeSplitLineFunction · 0.85
readLineFunction · 0.85
writeSAMlineWithIdNumFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected