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>

Ævar Arnfjörð Bjarmason committed May 25, 2017 at 19:45 UTC 543f1c0cb059ca41e23ee1ee1c12f812b135b01e
1 file changed +12 -12
grep.c
+12 -12
@@ -321,6 +321,18 @@ static NORETURN void compile_regexp_failed(const struct grep_pat *p,
321 die("%s'%s': %s", where, p->pattern, error);
322 }
323
324 +static int is_fixed(const char *s, size_t len)
325 +{
326 + size_t i;
327 +
328 + for (i = 0; i < len; i++) {
329 + if (is_regex_special(s[i]))
330 + return 0;
331 + }
332 +
333 + return 1;
334 +}
335 +
336 static int has_null(const char *s, size_t len)
337 {
338 /*
@@ -402,18 +414,6 @@ static void free_pcre1_regexp(struct grep_pat *p)
414 }
415 #endif /* !USE_LIBPCRE1 */
416
405 -static int is_fixed(const char *s, size_t len)
406 -{
407 - size_t i;
408 -
409 - for (i = 0; i < len; i++) {
410 - if (is_regex_special(s[i]))
411 - return 0;
412 - }
413 -
414 - return 1;
415 -}
416 -
417 static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
418 {
419 struct strbuf sb = STRBUF_INIT;