diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-09-01 01:17:53 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-02 09:16:23 -0700 |
| commit | 4b82d75b51eec202dc3d2b64e8de2ad9cb52d638 (patch) | |
| tree | 2ff4c7bff1f240a42f917e8a0123a5951cdb45f4 /builtin | |
| parent | 0b83b2b03a322a7948ddb453ab8766594ca239de (diff) | |
| download | git-4b82d75b51eec202dc3d2b64e8de2ad9cb52d638.tar.gz | |
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>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/submodule--helper.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 15bf89910f..60165a848a 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1664,7 +1664,7 @@ static int module_clone(int argc, const char **argv, const char *prefix) { int dissociate = 0, quiet = 0, progress = 0, require_init = 0; struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT; - struct list_objects_filter_options filter_options; + struct list_objects_filter_options filter_options = { 0 }; struct option module_clone_options[] = { OPT_STRING(0, "prefix", &clone_data.prefix, N_("path"), @@ -1704,7 +1704,6 @@ static int module_clone(int argc, const char **argv, const char *prefix) NULL }; - memset(&filter_options, 0, sizeof(filter_options)); argc = parse_options(argc, argv, prefix, module_clone_options, git_submodule_helper_usage, 0); @@ -2488,7 +2487,7 @@ static int module_update(int argc, const char **argv, const char *prefix) { struct pathspec pathspec; struct update_data opt = UPDATE_DATA_INIT; - struct list_objects_filter_options filter_options; + struct list_objects_filter_options filter_options = { 0 }; int ret; struct option module_update_options[] = { 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) update_clone_config_from_gitmodules(&opt.max_jobs); git_config(git_update_clone_config, &opt.max_jobs); - memset(&filter_options, 0, sizeof(filter_options)); argc = parse_options(argc, argv, prefix, module_update_options, git_submodule_helper_usage, 0); |
