diff mbox series

[v3,02/12] urlmatch.h: use config_fn_t type

Message ID 1aeffcb13956988dfb7b925f89bbe9c8503cb143.1687290232.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series config: remove global state from config iteration | expand

Commit Message

Glen Choo June 20, 2023, 7:43 p.m. UTC
From: Glen Choo <chooglen@google.com>

These are actually used as config callbacks, so use the typedef-ed type
and make future refactors easier.

Signed-off-by: Glen Choo <chooglen@google.com>
---
 urlmatch.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Junio C Hamano June 20, 2023, 9:02 p.m. UTC | #1
"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Glen Choo <chooglen@google.com>
>
> These are actually used as config callbacks, so use the typedef-ed type
> and make future refactors easier.
>
> Signed-off-by: Glen Choo <chooglen@google.com>
> ---
>  urlmatch.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/urlmatch.h b/urlmatch.h
> index 9f40b00bfb8..bee374a642c 100644
> --- a/urlmatch.h
> +++ b/urlmatch.h
> @@ -2,6 +2,7 @@
>  #define URL_MATCH_H
>  
>  #include "string-list.h"
> +#include "config.h"
>  
>  struct url_info {
>  	/* normalized url on success, must be freed, otherwise NULL */
> @@ -48,8 +49,8 @@ struct urlmatch_config {
>  	const char *key;
>  
>  	void *cb;
> -	int (*collect_fn)(const char *var, const char *value, void *cb);
> -	int (*cascade_fn)(const char *var, const char *value, void *cb);
> +	config_fn_t collect_fn;
> +	config_fn_t cascade_fn;

Makes sense.

>  	/*
>  	 * Compare the two matches, the one just discovered and the existing
>  	 * best match and return a negative value if the found item is to be
diff mbox series

Patch

diff --git a/urlmatch.h b/urlmatch.h
index 9f40b00bfb8..bee374a642c 100644
--- a/urlmatch.h
+++ b/urlmatch.h
@@ -2,6 +2,7 @@ 
 #define URL_MATCH_H
 
 #include "string-list.h"
+#include "config.h"
 
 struct url_info {
 	/* normalized url on success, must be freed, otherwise NULL */
@@ -48,8 +49,8 @@  struct urlmatch_config {
 	const char *key;
 
 	void *cb;
-	int (*collect_fn)(const char *var, const char *value, void *cb);
-	int (*cascade_fn)(const char *var, const char *value, void *cb);
+	config_fn_t collect_fn;
+	config_fn_t cascade_fn;
 	/*
 	 * Compare the two matches, the one just discovered and the existing
 	 * best match and return a negative value if the found item is to be