hook: rename cb_data_free/alloc -> hook_data_free/alloc
Rename the hook callback function types to use the hook prefix. This is a style fix with no logic changes. Suggested-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Adrian Ratiu committed
Mar 25, 2026 at 21:54 UTC
8f7db6f8b585a3eef4ba595efd2d098f9abf3606
2 files changed
+7
-7
hook.c
+2
-2
@@ -52,7 +52,7 @@ const char *find_hook(struct repository *r, const char *name)
52
return path.buf;
53
}
54
55
-static void hook_clear(struct hook *h, cb_data_free_fn cb_data_free)
55
+static void hook_clear(struct hook *h, hook_data_free_fn cb_data_free)
56
{
57
if (!h)
58
return;
@@ -70,7 +70,7 @@ static void hook_clear(struct hook *h, cb_data_free_fn cb_data_free)
70
free(h);
71
}
72
73
-void hook_list_clear(struct string_list *hooks, cb_data_free_fn cb_data_free)
73
+void hook_list_clear(struct string_list *hooks, hook_data_free_fn cb_data_free)
74
{
75
struct string_list_item *item;
76
hook.h
+5
-5
@@ -43,8 +43,8 @@ struct hook {
43
void *feed_pipe_cb_data;
44
};
45
46
-typedef void (*cb_data_free_fn)(void *data);
47
-typedef void *(*cb_data_alloc_fn)(void *init_ctx);
46
+typedef void (*hook_data_free_fn)(void *data);
47
+typedef void *(*hook_data_alloc_fn)(void *init_ctx);
48
49
struct run_hooks_opt {
50
/* Environment vars to be set for each hook */
@@ -131,14 +131,14 @@ struct run_hooks_opt {
131
*
132
* The `feed_pipe_ctx` pointer can be used to pass initialization data.
133
*/
134
- cb_data_alloc_fn feed_pipe_cb_data_alloc;
134
+ hook_data_alloc_fn feed_pipe_cb_data_alloc;
135
136
/**
137
* Called to free the memory initialized by `feed_pipe_cb_data_alloc`.
138
*
139
* Must always be provided when `feed_pipe_cb_data_alloc` is provided.
140
*/
141
- cb_data_free_fn feed_pipe_cb_data_free;
141
+ hook_data_free_fn feed_pipe_cb_data_free;
142
};
143
144
#define RUN_HOOKS_OPT_INIT { \
@@ -188,7 +188,7 @@ struct string_list *list_hooks(struct repository *r, const char *hookname,
188
* Frees the memory allocated for the hook list, including the `struct hook`
189
* items and their internal state.
190
*/
191
-void hook_list_clear(struct string_list *hooks, cb_data_free_fn cb_data_free);
191
+void hook_list_clear(struct string_list *hooks, hook_data_free_fn cb_data_free);
192
193
/**
194
* Frees the hook configuration cache stored in `struct repository`.