Skip to content

Commit e417151

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 17b44ae commit e417151

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

checkout.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ struct tracking_name_data {
1010
int unique;
1111
};
1212

13+
#define TRACKING_NAME_DATA_INIT { NULL, NULL, NULL, 1 }
14+
1315
static int check_tracking_name(struct remote *remote, void *cb_data)
1416
{
1517
struct tracking_name_data *cb = cb_data;
@@ -32,7 +34,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
3234

3335
const char *unique_tracking_name(const char *name, struct object_id *oid)
3436
{
35-
struct tracking_name_data cb_data = { NULL, NULL, NULL, 1 };
37+
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
3638
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
3739
cb_data.dst_oid = oid;
3840
for_each_remote(check_tracking_name, &cb_data);

0 commit comments

Comments
 (0)