author | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Jun 2010 18:21:44 +0000 (11:21 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Jun 2010 18:21:44 +0000 (11:21 -0700) |
* rs/grep-binary:
grep: support NUL chars in search strings for -F
grep: use REG_STARTEND for all matching if available
grep: continue case insensitive fixed string search after NUL chars
grep: use memmem() for fixed string search
grep: --name-only over binary
grep: --count over binary
grep: grep: refactor handling of binary mode options
grep: add test script for binary file handling
grep: support NUL chars in search strings for -F
grep: use REG_STARTEND for all matching if available
grep: continue case insensitive fixed string search after NUL chars
grep: use memmem() for fixed string search
grep: --name-only over binary
grep: --count over binary
grep: grep: refactor handling of binary mode options
grep: add test script for binary file handling
1 | 2 | |||
---|---|---|---|---|
builtin/grep.c | patch | | diff1 | | diff2 | | blob | history |
diff --combined builtin/grep.c
index b194ea3cea531f3a6c81d6d27b5b3028641ba9ce,7653d8492a9f26b47cfaeec64f717107ffa204bc..d0a73da07a0d7d8d4b01adcfcda88a98130910a0
--- 1/builtin/grep.c
--- 2/builtin/grep.c
+++ b/builtin/grep.c
#include "dir.h"
#ifndef NO_PTHREADS
-#include "thread-utils.h"
#include <pthread.h>
+#include "thread-utils.h"
#endif
static char const * const grep_usage[] = {
if (!patterns)
die_errno("cannot open '%s'", arg);
while (strbuf_getline(&sb, patterns, '\n') == 0) {
+ char *s;
+ size_t len;
+
/* ignore empty line like grep does */
if (sb.len == 0)
continue;
- append_grep_pattern(grep_opt, strbuf_detach(&sb, NULL), arg,
- ++lno, GREP_PATTERN);
+
+ s = strbuf_detach(&sb, &len);
+ append_grep_pat(grep_opt, s, len, arg, ++lno, GREP_PATTERN);
}
fclose(patterns);
strbuf_release(&sb);