summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-05-25 19:45:30 +0000
committerJunio C Hamano <gitster@pobox.com>2017-05-26 12:52:37 +0900
commit543f1c0cb059ca41e23ee1ee1c12f812b135b01e (patch)
tree3ae4d641ed5b52f7694672b861e32bdc54ab28fd /grep.c
parent6d4b5747f06754efd467d3dde32367f27615fa7b (diff)
downloadgit-543f1c0cb059ca41e23ee1ee1c12f812b135b01e.tar.gz
grep: move is_fixed() earlier to avoid forward declaration
Move the is_fixed() function which are currently only used in compile_regexp() earlier so it can be used in the PCRE family of functions in a later change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/grep.c b/grep.c
index 2d54baeaa3..d03d424e5c 100644
--- a/grep.c
+++ b/grep.c
@@ -321,6 +321,18 @@ static NORETURN void compile_regexp_failed(const struct grep_pat *p,
die("%s'%s': %s", where, p->pattern, error);
}
+static int is_fixed(const char *s, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len; i++) {
+ if (is_regex_special(s[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
static int has_null(const char *s, size_t len)
{
/*
@@ -402,18 +414,6 @@ static void free_pcre1_regexp(struct grep_pat *p)
}
#endif /* !USE_LIBPCRE1 */
-static int is_fixed(const char *s, size_t len)
-{
- size_t i;
-
- for (i = 0; i < len; i++) {
- if (is_regex_special(s[i]))
- return 0;
- }
-
- return 1;
-}
-
static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
{
struct strbuf sb = STRBUF_INIT;