checkout.c: introduce an *_INIT macro
Add an *_INIT macro for the tracking_name_data similar to what exists elsewhere in the codebase, e.g. OID_ARRAY_INIT in sha1-array.h. This will make it more idiomatic in later changes to add more fields to the struct & its initialization macro. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jun 5, 2018 at 14:40 UTC
e417151b24bcf1277a48fc6e9a5c184998402428
1 file changed
+3
-1
checkout.c
+3
-1
@@ -10,6 +10,8 @@ struct tracking_name_data {
10
int unique;
11
};
12
13
+#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL, 1 }
14
+
15
static int check_tracking_name(struct remote *remote, void *cb_data)
16
{
17
struct tracking_name_data *cb = cb_data;
@@ -32,7 +34,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
34
35
const char *unique_tracking_name(const char *name, struct object_id *oid)
36
{
35
- struct tracking_name_data cb_data = { NULL, NULL, NULL, 1 };
37
+ struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
38
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
39
cb_data.dst_oid = oid;
40
for_each_remote(check_tracking_name, &cb_data);