diff mbox series

[v2,1/8] grep.h: remove unused "regex_t regexp" from grep_opt

Message ID patch-v2-1.8-1435db727ef-20211110T013632Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series grep: simplify & delete code by changing obscure cfg variable behavior | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 10, 2021, 1:43 a.m. UTC
This "regex_t" in grep_opt has not been used since
f9b9faf6f8a (builtin-grep: allow more than one patterns., 2006-05-02),
we still use a "regex_t" for compiling regexes, but that's in the
"grep_pat" struct".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 grep.h | 1 -
 1 file changed, 1 deletion(-)

Comments

Junio C Hamano Nov. 12, 2021, 4:11 p.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> This "regex_t" in grep_opt has not been used since
> f9b9faf6f8a (builtin-grep: allow more than one patterns., 2006-05-02),
> we still use a "regex_t" for compiling regexes, but that's in the
> "grep_pat" struct".
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  grep.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/grep.h b/grep.h
> index 3e8815c347b..95cccb670f9 100644
> --- a/grep.h
> +++ b/grep.h
> @@ -136,7 +136,6 @@ struct grep_opt {
>  
>  	const char *prefix;
>  	int prefix_length;
> -	regex_t regexp;
>  	int linenum;
>  	int columnnum;
>  	int invert;

I would have expected "this used to be used but no longer; only
initialization of and assignment to it remain"; I am somewhat
surprised to see there is no mention to it anywhere in the code ;-)

Good find.
diff mbox series

Patch

diff --git a/grep.h b/grep.h
index 3e8815c347b..95cccb670f9 100644
--- a/grep.h
+++ b/grep.h
@@ -136,7 +136,6 @@  struct grep_opt {
 
 	const char *prefix;
 	int prefix_length;
-	regex_t regexp;
 	int linenum;
 	int columnnum;
 	int invert;