* src/grep.c (setmatcher): Look for NULL matchers[i].name. * src/grep.h (struct matcher): Change name to pointer. Adjust comments. * src/search.c (matchers): Terminate with three NULLs. --- src/grep.c | 2 +- src/grep.h | 4 ++-- src/search.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/grep.c b/src/grep.c index 8193bc5..538d4c8 100644 --- a/src/grep.c +++ b/src/grep.c @@ -1586,7 +1586,7 @@ install_matcher (char const *name) { int i; - for (i = 0; matchers[i].compile; i++) + for (i = 0; matchers[i].name; i++) if (strcmp (name, matchers[i].name) == 0) { compile = matchers[i].compile; diff --git a/src/grep.h b/src/grep.h index 51b6d0c..8a0ca3b 100644 --- a/src/grep.h +++ b/src/grep.h @@ -47,11 +47,11 @@ typedef COMPILE_RET (*compile_fp_t) COMPILE_ARGS; typedef EXECUTE_RET (*execute_fp_t) EXECUTE_ARGS; /* grep.c expects the matchers vector to be terminated - by an entry with a NULL compile, and to contain at least + by an entry with a NULL name, and to contain at least an entry named "default". */ extern struct matcher { - char name[8]; + const char *name; compile_fp_t compile; execute_fp_t execute; } const matchers[]; diff --git a/src/search.c b/src/search.c index 1d3868a..9cb4abb 100644 --- a/src/search.c +++ b/src/search.c @@ -847,6 +847,6 @@ struct matcher const matchers[] = { { "awk", Acompile, EGexecute }, { "fgrep", Fcompile, Fexecute }, { "perl", Pcompile, Pexecute }, - { "", 0, 0 }, + { NULL, NULL, NULL }, }; #endif /* GREP_PROGRAM */ -- 1.6.6.1