summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorLibravatar René Scharfe <rene.scharfe@lsrfire.ath.cx>2010-05-22 23:43:43 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-05-24 11:22:07 -0700
commited40a0951cedb70777669144478166aa5bb2cf9c (patch)
tree5683f6f847d31d83e2ddf9ff38f953eff916aa10 /grep.h
parentgrep: use REG_STARTEND for all matching if available (diff)
downloadtgif-ed40a0951cedb70777669144478166aa5bb2cf9c.tar.xz
grep: support NUL chars in search strings for -F
Search patterns in a file specified with -f can contain NUL characters. The current code ignores all characters on a line after a NUL. Pass the actual length of the line all the way from the pattern file to fixmatch() and use it for case-sensitive fixed string matching. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 89342e5b47..0aebebd966 100644
--- a/grep.h
+++ b/grep.h
@@ -29,6 +29,7 @@ struct grep_pat {
int no;
enum grep_pat_token token;
const char *pattern;
+ size_t patternlen;
enum grep_header_field field;
regex_t regexp;
unsigned fixed:1;
@@ -104,6 +105,7 @@ struct grep_opt {
void *output_priv;
};
+extern void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t);
extern void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t);
extern void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
extern void compile_grep_patterns(struct grep_opt *opt);