static void processMatch(Regex* re, SearchOutput* output, OrderedOutput::Chunk* chunk, HighlightBuffer& hlbuf, const char* path, size_t pathLength, const char* line, size_t lineLength, unsigned int lineNumber, const char* preparedRange, size_t matchOffset, size_t matchLength) { if (output->options & SO_VISUALSTUDIO) { char* buffer = static_cast<char*>(alloca(pathLength)); std::transform(path, path + pathLength, buffer, BackSlashTransformer()); path = buffer; } char linecolumn[256]; size_t linecolumnsize = printMatchLineColumn(lineNumber, matchOffset + 1, output->options, linecolumn); chunk->result.reserve(chunk->result.size() + pathLength + lineLength + 256); if (output->options & SO_HIGHLIGHT) chunk->result += kHighlightPath; chunk->result.insert(chunk->result.end(), path, path + pathLength); chunk->result.insert(chunk->result.end(), linecolumn, linecolumn + linecolumnsize); if (output->options & SO_HIGHLIGHT) chunk->result += kHighlightEnd; if (output->options & SO_HIGHLIGHT_MATCHES) printHighlightMatch(chunk->result, re, hlbuf, line, lineLength, preparedRange, matchOffset, matchLength); else chunk->result.insert(chunk->result.end(), line, line + lineLength); chunk->result += "\n"; output->output.write(chunk); }
static void processMatch(const char* path, size_t pathLength, FilterOutput* output) { if (output->options & SO_VISUALSTUDIO) { char* buffer = static_cast<char*>(alloca(pathLength)); std::transform(path, path + pathLength, buffer, BackSlashTransformer()); path = buffer; } output->output->rawprint(path, pathLength); output->output->rawprint("\n", 1); }