submodule--helper: replace memset() with { 0 }-initialization

Use the less verbose { 0 }-initialization syntax rather than memset() in builtin/submodule--helper.c, this doesn't make a difference in terms of behavior, but as we're about to modify adjacent code makes this more consistent, and lets us avoid worrying about when the memset() happens v.s. a "goto cleanup". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 1, 2022 at 01:17 UTC 4b82d75b51eec202dc3d2b64e8de2ad9cb52d638
1 file changed +2 -4
builtin/submodule--helper.c
+2 -4
@@ -1664,7 +1664,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1664 {
1665 int dissociate = 0, quiet = 0, progress = 0, require_init = 0;
1666 struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT;
1667 - struct list_objects_filter_options filter_options;
1667 + struct list_objects_filter_options filter_options = { 0 };
1668 struct option module_clone_options[] = {
1669 OPT_STRING(0, "prefix", &clone_data.prefix,
1670 N_("path"),
@@ -1704,7 +1704,6 @@ static int module_clone(int argc, const char **argv, const char *prefix)
1704 NULL
1705 };
1706
1707 - memset(&filter_options, 0, sizeof(filter_options));
1707 argc = parse_options(argc, argv, prefix, module_clone_options,
1708 git_submodule_helper_usage, 0);
1709
@@ -2488,7 +2487,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
2487 {
2488 struct pathspec pathspec;
2489 struct update_data opt = UPDATE_DATA_INIT;
2491 - struct list_objects_filter_options filter_options;
2490 + struct list_objects_filter_options filter_options = { 0 };
2491 int ret;
2492 struct option module_update_options[] = {
2493 OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
@@ -2546,7 +2545,6 @@ static int module_update(int argc, const char **argv, const char *prefix)
2545 update_clone_config_from_gitmodules(&opt.max_jobs);
2546 git_config(git_update_clone_config, &opt.max_jobs);
2547
2549 - memset(&filter_options, 0, sizeof(filter_options));
2548 argc = parse_options(argc, argv, prefix, module_update_options,
2549 git_submodule_helper_usage, 0);
2550