diff mbox series

[v2,5/8] grep.c: don't pass along NULL callback value

Message ID patch-v2-5.8-d0f0ac6c7ae-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
Change grep_cmd_config() top stop passing around the always-NULL "cb"
value. When this code was added in 7e8f59d577e (grep: color patterns
in output, 2009-03-07) it was non-NULL, but when that changed in
15fabd1bbd4 (builtin/grep.c: make configuration callback more
reusable, 2012-10-09) this code was left behind.

In a subsequent change I'll start using the "cb" value, this will make
it clear which functions we call need it, and which don't.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/grep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

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

> Change grep_cmd_config() top stop passing around the always-NULL "cb"

"Change X top stop passing"?  I cannot guess so I will not say "I'll
fix it to X, no need to resend".

The change itself does seem sensible.

Thanks.

> value. When this code was added in 7e8f59d577e (grep: color patterns
> in output, 2009-03-07) it was non-NULL, but when that changed in
> 15fabd1bbd4 (builtin/grep.c: make configuration callback more
> reusable, 2012-10-09) this code was left behind.
>
> In a subsequent change I'll start using the "cb" value, this will make
> it clear which functions we call need it, and which don't.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  builtin/grep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/grep.c b/builtin/grep.c
> index d85cbabea67..5ec4cecae45 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -285,8 +285,8 @@ static int wait_all(void)
>  
>  static int grep_cmd_config(const char *var, const char *value, void *cb)
>  {
> -	int st = grep_config(var, value, cb);
> -	if (git_color_default_config(var, value, cb) < 0)
> +	int st = grep_config(var, value, NULL);
> +	if (git_color_default_config(var, value, NULL) < 0)
>  		st = -1;
>  
>  	if (!strcmp(var, "grep.threads")) {
diff mbox series

Patch

diff --git a/builtin/grep.c b/builtin/grep.c
index d85cbabea67..5ec4cecae45 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -285,8 +285,8 @@  static int wait_all(void)
 
 static int grep_cmd_config(const char *var, const char *value, void *cb)
 {
-	int st = grep_config(var, value, cb);
-	if (git_color_default_config(var, value, cb) < 0)
+	int st = grep_config(var, value, NULL);
+	if (git_color_default_config(var, value, NULL) < 0)
 		st = -1;
 
 	if (!strcmp(var, "grep.threads")) {