Skip to content

Commit 543f1c0

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6d4b574 commit 543f1c0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

grep.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,18 @@ static NORETURN void compile_regexp_failed(const struct grep_pat *p,
321321
die("%s'%s': %s", where, p->pattern, error);
322322
}
323323

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+
324336
static int has_null(const char *s, size_t len)
325337
{
326338
/*
@@ -402,18 +414,6 @@ static void free_pcre1_regexp(struct grep_pat *p)
402414
}
403415
#endif /* !USE_LIBPCRE1 */
404416

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-
417417
static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
418418
{
419419
struct strbuf sb = STRBUF_INIT;

0 commit comments

Comments
 (0)