{"thread":{"id":"15840","subject":"[RFC PATCH 1/2] Replace memset(0) with static initialization where possible","startedAt":"2008-10-09T19:09:16Z","lastAt":"2008-10-09T21:12:36Z","messageCount":6,"participants":["Brandon Casey","Shawn O. Pearce","Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"92694","messageId":"NveF6_7LIvvEmRZEvLeTO5lw7EzzmOQkz1WGEMYGSFKDWqSwAeLwBw@cipher.nrlssc.navy.mil","threadId":"15840","inReplyTo":null,"subject":"[RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-10-09T19:09:16Z","receivedAt":"2008-10-09T19:09:16Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Many call sites use memset to initialize a local variable which has not\nbeen accessed since its declaration. This call to memset is unnecessary\n(even though it may not evaluate to an actual function call). Replacing\nthese calls with static initialization may be optimal on some platforms\nand increases readability in many cases.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nIs there interest in a patch like this?\n\n\"Possible\" benefits:\n\n  1) more concise, so it improves readability in most cases\n  2) gives compiler more flexibility when optimizing\n\nDrawbacks:\n\n  1) many lines touched for no functional change\n  2) other?\n\n\nMost of these changes boil down to something of the from:\n\n   some_struct foo;\n   memset(&foo, 0, sizeof(foo));\n\nto\n\n   some_struct foo = { 0, };\n\nwhere the declaration and the memset have very little code separating\nthem and are contained in the same hunk. A few are separated by more\ncode and are in different hunks, but it is straight-forward to check\nthose cases.\n\n-brandon\n\n\n archive-tar.c            |    3 +--\n archive-zip.c            |    3 +--\n branch.c                 |    3 +--\n builtin-apply.c          |   10 +++-------\n builtin-blame.c          |    9 +++------\n builtin-branch.c         |    3 +--\n builtin-bundle.c         |    3 +--\n builtin-checkout.c       |   23 ++++++++---------------\n builtin-clean.c          |    3 +--\n builtin-clone.c          |    3 +--\n builtin-commit.c         |    9 +++------\n builtin-fetch-pack.c     |    6 ++----\n builtin-fetch.c          |    3 +--\n builtin-for-each-ref.c   |    3 +--\n builtin-gc.c             |    3 +--\n builtin-grep.c           |    3 +--\n builtin-help.c           |    3 +--\n builtin-log.c            |    3 +--\n builtin-ls-files.c       |    3 +--\n builtin-merge.c          |   28 +++++++++-------------------\n builtin-pack-objects.c   |   10 +++-------\n builtin-read-tree.c      |    3 +--\n builtin-receive-pack.c   |    9 +++------\n builtin-reflog.c         |   20 ++++++--------------\n builtin-remote.c         |   15 +++++----------\n builtin-rerere.c         |    3 +--\n builtin-reset.c          |    3 +--\n builtin-send-pack.c      |    6 ++----\n builtin-tag.c            |    3 +--\n builtin-unpack-objects.c |    4 +---\n builtin-verify-tag.c     |    3 +--\n bundle.c                 |    9 +++------\n combine-diff.c           |    6 ++----\n connect.c                |    6 ++----\n convert.c                |    6 ++----\n daemon.c                 |   12 ++++--------\n date.c                   |    3 +--\n diff-lib.c               |    6 ++----\n diff.c                   |   30 ++++++++++--------------------\n fast-import.c            |    6 ++----\n help.c                   |    4 +---\n http-push.c              |    3 +--\n imap-send.c              |    7 ++-----\n index-pack.c             |    9 +++------\n ll-merge.c               |    6 ++----\n merge-file.c             |    6 ++----\n merge-index.c            |    3 +--\n merge-recursive.c        |    3 +--\n merge-tree.c             |    3 +--\n pack-refs.c              |    3 +--\n pretty.c                 |    3 +--\n progress.c               |    3 +--\n sha1_file.c              |    9 +++------\n transport.c              |   16 +++++-----------\n unpack-trees.c           |    3 +--\n upload-pack.c            |    3 +--\n wt-status.c              |    6 ++----\n xdiff-interface.c        |    3 +--\n 58 files changed, 125 insertions(+), 258 deletions(-)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 1302961..e3170fb 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -123,11 +123,10 @@ static int write_tar_entry(struct archiver_args *args,\n \t\tconst unsigned char *sha1, const char *path, size_t pathlen,\n \t\tunsigned int mode, void *buffer, unsigned long size)\n {\n-\tstruct ustar_header header;\n+\tstruct ustar_header header = { { 0, }, };\n \tstruct strbuf ext_header;\n \tint err = 0;\n \n-\tmemset(&header, 0, sizeof(header));\n \tstrbuf_init(&ext_header, 0);\n \n \tif (!sha1) {\ndiff --git a/archive-zip.c b/archive-zip.c\nindex cf28504..6196e5f 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -90,12 +90,11 @@ static void copy_le32(unsigned char *dest, unsigned int n)\n static void *zlib_deflate(void *data, unsigned long size,\n \t\tint compression_level, unsigned long *compressed_size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tunsigned long maxsize;\n \tvoid *buffer;\n \tint result;\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, compression_level);\n \tmaxsize = deflateBound(&stream, size);\n \tbuffer = xmalloc(maxsize);\ndiff --git a/branch.c b/branch.c\nindex b1e59f2..057f0a3 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -56,13 +56,12 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n                           enum branch_track track)\n {\n \tchar key[1024];\n-\tstruct tracking tracking;\n+\tstruct tracking tracking = { { 0, }, };\n \n \tif (strlen(new_ref) > 1024 - 7 - 7 - 1)\n \t\treturn error(\"Tracking not set up: name too long: %s\",\n \t\t\t\tnew_ref);\n \n-\tmemset(&tracking, 0, sizeof(tracking));\n \ttracking.spec.dst = (char *)orig_ref;\n \tif (for_each_remote(find_tracked_branch, &tracking))\n \t\treturn 1;\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex 342f2fe..945616e 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -1241,12 +1241,10 @@ static inline int metadata_changes(struct patch *patch)\n static char *inflate_it(const void *data, unsigned long size,\n \t\t\tunsigned long inflated_size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tvoid *out;\n \tint st;\n \n-\tmemset(&stream, 0, sizeof(stream));\n-\n \tstream.next_in = (unsigned char *)data;\n \tstream.avail_in = size;\n \tstream.next_out = out = xmalloc(inflated_size);\n@@ -1891,11 +1889,9 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,\n \tint new_blank_lines_at_end = 0;\n \tunsigned long leading, trailing;\n \tint pos, applied_pos;\n-\tstruct image preimage;\n-\tstruct image postimage;\n+\tstruct image preimage = { 0, };\n+\tstruct image postimage = { 0, };\n \n-\tmemset(&preimage, 0, sizeof(preimage));\n-\tmemset(&postimage, 0, sizeof(postimage));\n \toldlines = xmalloc(size);\n \tnewlines = xmalloc(size);\n \ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex df53759..93d2daf 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -518,15 +518,13 @@ static void process_u_diff(void *state_, char *line, unsigned long len)\n static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,\n \t\t\t\t    int context)\n {\n-\tstruct blame_diff_state state;\n+\tstruct blame_diff_state state = { 0, };\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \txdemitcb_t ecb;\n \n \txpp.flags = xdl_opts;\n-\tmemset(&xecfg, 0, sizeof(xecfg));\n \txecfg.ctxlen = context;\n-\tmemset(&state, 0, sizeof(state));\n \tstate.ret = xmalloc(sizeof(struct patch));\n \tstate.ret->chunks = NULL;\n \tstate.ret->num = 0;\n@@ -2279,7 +2277,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info revs;\n \tconst char *path;\n-\tstruct scoreboard sb;\n+\tstruct scoreboard sb = { 0, };\n \tstruct origin *o;\n \tstruct blame_entry *ent;\n \tlong dashdash_pos, bottom, top, lno;\n@@ -2405,7 +2403,6 @@ parse_done:\n \t}\n \n \tsetup_revisions(argc, argv, &revs, NULL);\n-\tmemset(&sb, 0, sizeof(sb));\n \n \tsb.revs = &revs;\n \tif (!reverse)\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex b1a2ad7..6e2c614 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -379,10 +379,9 @@ static int calc_maxwidth(struct ref_list *refs)\n static void print_ref_list(int kinds, int detached, int verbose, int abbrev, struct commit_list *with_commit)\n {\n \tint i;\n-\tstruct ref_list ref_list;\n+\tstruct ref_list ref_list = { { 0, }, };\n \tstruct commit *head_commit = lookup_commit_reference_gently(head_sha1, 1);\n \n-\tmemset(&ref_list, 0, sizeof(ref_list));\n \tref_list.kinds = kinds;\n \tref_list.with_commit = with_commit;\n \tif (merge_filter != NO_FILTER)\ndiff --git a/builtin-bundle.c b/builtin-bundle.c\nindex 9b58152..fa2b6e6 100644\n--- a/builtin-bundle.c\n+++ b/builtin-bundle.c\n@@ -13,7 +13,7 @@ static const char *bundle_usage=\"git bundle (create <bundle> <git rev-list args>\n \n int cmd_bundle(int argc, const char **argv, const char *prefix)\n {\n-\tstruct bundle_header header;\n+\tstruct bundle_header header = { { 0, }, };\n \tint nongit;\n \tconst char *cmd, *bundle_file;\n \tint bundle_fd = -1;\n@@ -33,7 +33,6 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)\n \t\tbundle_file = buffer;\n \t}\n \n-\tmemset(&header, 0, sizeof(header));\n \tif (strcmp(cmd, \"create\") && (bundle_fd =\n \t\t\t\tread_bundle_header(bundle_file, &header)) < 0)\n \t\treturn 1;\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nindex 3762f71..f167a98 100644\n--- a/builtin-checkout.c\n+++ b/builtin-checkout.c\n@@ -38,14 +38,13 @@ struct checkout_opts {\n static int post_checkout_hook(struct commit *old, struct commit *new,\n \t\t\t      int changed)\n {\n-\tstruct child_process proc;\n+\tstruct child_process proc = { 0, };\n \tconst char *name = git_path(\"hooks/post-checkout\");\n \tconst char *argv[5];\n \n \tif (access(name, X_OK) < 0)\n \t\treturn 0;\n \n-\tmemset(&proc, 0, sizeof(proc));\n \targv[0] = name;\n \targv[1] = xstrdup(sha1_to_hex(old->object.sha1));\n \targv[2] = xstrdup(sha1_to_hex(new->object.sha1));\n@@ -216,7 +215,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,\n \t\t\t  struct checkout_opts *opts)\n {\n \tint pos;\n-\tstruct checkout state;\n+\tstruct checkout state = { 0, };\n \tstatic char *ps_matched;\n \tunsigned char rev[20];\n \tint flag;\n@@ -268,7 +267,6 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,\n \t\treturn 1;\n \n \t/* Now we are committed to check them out */\n-\tmemset(&state, 0, sizeof(state));\n \tstate.force = 1;\n \tstate.refresh_cache = 1;\n \tfor (pos = 0; pos < active_nr; pos++) {\n@@ -321,10 +319,9 @@ static void describe_detached_head(char *msg, struct commit *commit)\n \n static int reset_tree(struct tree *tree, struct checkout_opts *o, int worktree)\n {\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \tstruct tree_desc tree_desc;\n \n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = -1;\n \topts.update = worktree;\n \topts.skip_unmerged = !worktree;\n@@ -382,9 +379,8 @@ static int merge_working_tree(struct checkout_opts *opts,\n \t} else {\n \t\tstruct tree_desc trees[2];\n \t\tstruct tree *tree;\n-\t\tstruct unpack_trees_options topts;\n+\t\tstruct unpack_trees_options topts = { 0, };\n \n-\t\tmemset(&topts, 0, sizeof(topts));\n \t\ttopts.head_idx = -1;\n \t\ttopts.src_index = &the_index;\n \t\ttopts.dst_index = &the_index;\n@@ -529,10 +525,10 @@ static void update_refs_for_switch(struct checkout_opts *opts,\n static int switch_branches(struct checkout_opts *opts, struct branch_info *new)\n {\n \tint ret = 0;\n-\tstruct branch_info old;\n+\tstruct branch_info old = { 0, };\n \tunsigned char rev[20];\n \tint flag;\n-\tmemset(&old, 0, sizeof(old));\n+\n \told.path = resolve_ref(\"HEAD\", rev, 0, &flag);\n \told.commit = lookup_commit_reference_gently(rev, 1);\n \tif (!(flag & REF_ISSYMREF))\n@@ -582,10 +578,10 @@ static int git_checkout_config(const char *var, const char *value, void *cb)\n \n int cmd_checkout(int argc, const char **argv, const char *prefix)\n {\n-\tstruct checkout_opts opts;\n+\tstruct checkout_opts opts = { 0, };\n \tunsigned char rev[20];\n \tconst char *arg;\n-\tstruct branch_info new;\n+\tstruct branch_info new = { 0, };\n \tstruct tree *source_tree = NULL;\n \tchar *conflict_style = NULL;\n \tstruct option options[] = {\n@@ -606,9 +602,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t};\n \tint has_dash_dash;\n \n-\tmemset(&opts, 0, sizeof(opts));\n-\tmemset(&new, 0, sizeof(new));\n-\n \tgit_config(git_checkout_config, NULL);\n \n \topts.track = BRANCH_TRACK_UNSPECIFIED;\ndiff --git a/builtin-clean.c b/builtin-clean.c\nindex 48bf29f..357d398 100644\n--- a/builtin-clean.c\n+++ b/builtin-clean.c\n@@ -32,7 +32,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \tint show_only = 0, remove_directories = 0, quiet = 0, ignored = 0;\n \tint ignored_only = 0, baselen = 0, config_set = 0, errors = 0;\n \tstruct strbuf directory;\n-\tstruct dir_struct dir;\n+\tstruct dir_struct dir = { 0, };\n \tconst char *path, *base;\n \tstatic const char **pathspec;\n \tstruct strbuf buf;\n@@ -59,7 +59,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)\n \targc = parse_options(argc, argv, options, builtin_clean_usage, 0);\n \n \tstrbuf_init(&buf, 0);\n-\tmemset(&dir, 0, sizeof(dir));\n \tif (ignored_only)\n \t\tdir.show_ignored = 1;\n \ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 49d2eb9..d1d5fe8 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -572,7 +572,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \tif (!option_no_checkout) {\n \t\tstruct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));\n-\t\tstruct unpack_trees_options opts;\n+\t\tstruct unpack_trees_options opts = { 0, };\n \t\tstruct tree *tree;\n \t\tstruct tree_desc t;\n \t\tint fd;\n@@ -582,7 +582,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \n \t\tfd = hold_locked_index(lock_file, 1);\n \n-\t\tmemset(&opts, 0, sizeof opts);\n \t\topts.update = 1;\n \t\topts.merge = 1;\n \t\topts.fn = oneway_merge;\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex b920257..69d8492 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -192,7 +192,7 @@ static void add_remove_files(struct string_list *list)\n static void create_base_index(void)\n {\n \tstruct tree *tree;\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \tstruct tree_desc t;\n \n \tif (initial_commit) {\n@@ -200,7 +200,6 @@ static void create_base_index(void)\n \t\treturn;\n \t}\n \n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = 1;\n \topts.index_only = 1;\n \topts.merge = 1;\n@@ -220,7 +219,7 @@ static void create_base_index(void)\n static char *prepare_index(int argc, const char **argv, const char *prefix)\n {\n \tint fd;\n-\tstruct string_list partial;\n+\tstruct string_list partial = { 0, };\n \tconst char **pathspec = NULL;\n \n \tif (interactive) {\n@@ -303,7 +302,6 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)\n \tif (file_exists(git_path(\"MERGE_HEAD\")))\n \t\tdie(\"cannot do a partial commit during a merge.\");\n \n-\tmemset(&partial, 0, sizeof(partial));\n \tpartial.strdup_strings = 1;\n \tif (list_paths(&partial, initial_commit ? NULL : \"HEAD\", prefix, pathspec))\n \t\texit(1);\n@@ -361,7 +359,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \n static int run_hook(const char *index_file, const char *name, ...)\n {\n-\tstruct child_process hook;\n+\tstruct child_process hook = { 0, };\n \tconst char *argv[10], *env[2];\n \tchar index[PATH_MAX];\n \tva_list args;\n@@ -384,7 +382,6 @@ static int run_hook(const char *index_file, const char *name, ...)\n \tif (access(argv[0], X_OK) < 0)\n \t\treturn 0;\n \n-\tmemset(&hook, 0, sizeof(hook));\n \thook.argv = argv;\n \thook.no_stdin = 1;\n \thook.stdout_to_stderr = 1;\ndiff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c\nindex fa3c936..efd7a56 100644\n--- a/builtin-fetch-pack.c\n+++ b/builtin-fetch-pack.c\n@@ -488,15 +488,14 @@ static int sideband_demux(int fd, void *data)\n \n static int get_pack(int xd[2], char **pack_lockfile)\n {\n-\tstruct async demux;\n+\tstruct async demux = { 0, };\n \tconst char *argv[20];\n \tchar keep_arg[256];\n \tchar hdr_arg[256];\n \tconst char **av;\n \tint do_keep = args.keep_pack;\n-\tstruct child_process cmd;\n+\tstruct child_process cmd = { 0, };\n \n-\tmemset(&demux, 0, sizeof(demux));\n \tif (use_sideband) {\n \t\t/* xd[] is talking with upload-pack; subprocess reads from\n \t\t * xd[0], spits out band#2 to stderr, and feeds us band#1\n@@ -511,7 +510,6 @@ static int get_pack(int xd[2], char **pack_lockfile)\n \telse\n \t\tdemux.out = xd[0];\n \n-\tmemset(&cmd, 0, sizeof(cmd));\n \tcmd.argv = argv;\n \tav = argv;\n \t*hdr_arg = 0;\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex ee93d3a..16e04dd 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -404,7 +404,7 @@ static int store_updated_refs(const char *url, const char *remote_name,\n  */\n static int quickfetch(struct ref *ref_map)\n {\n-\tstruct child_process revlist;\n+\tstruct child_process revlist = { 0, };\n \tstruct ref *ref;\n \tchar **argv;\n \tint i, err;\n@@ -435,7 +435,6 @@ static int quickfetch(struct ref *ref_map)\n \targv[i++] = xstrdup(\"--all\");\n \targv[i++] = NULL;\n \n-\tmemset(&revlist, 0, sizeof(revlist));\n \trevlist.argv = (const char**)argv;\n \trevlist.git_cmd = 1;\n \trevlist.no_stdin = 1;\ndiff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\nindex fa6c1ed..ea60ec9 100644\n--- a/builtin-for-each-ref.c\n+++ b/builtin-for-each-ref.c\n@@ -964,7 +964,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)\n \tstruct ref_sort *sort = NULL, **sort_tail = &sort;\n \tint maxcount = 0, quote_style = 0;\n \tstruct refinfo **refs;\n-\tstruct grab_ref_cbdata cbdata;\n+\tstruct grab_ref_cbdata cbdata = { 0, };\n \n \tstruct option opts[] = {\n \t\tOPT_BIT('s', \"shell\", &quote_style,\n@@ -1000,7 +1000,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)\n \t\tsort = default_sort();\n \tsort_atom_limit = used_atom_cnt;\n \n-\tmemset(&cbdata, 0, sizeof(cbdata));\n \tcbdata.grab_pattern = argv;\n \tfor_each_ref(grab_single_ref, &cbdata);\n \trefs = cbdata.grab_array;\ndiff --git a/builtin-gc.c b/builtin-gc.c\nindex 7af65bb..78e9bbd 100644\n--- a/builtin-gc.c\n+++ b/builtin-gc.c\n@@ -157,7 +157,7 @@ static int too_many_packs(void)\n static int run_hook(void)\n {\n \tconst char *argv[2];\n-\tstruct child_process hook;\n+\tstruct child_process hook = { 0, };\n \tint ret;\n \n \targv[0] = git_path(\"hooks/pre-auto-gc\");\n@@ -166,7 +166,6 @@ static int run_hook(void)\n \tif (access(argv[0], X_OK) < 0)\n \t\treturn 0;\n \n-\tmemset(&hook, 0, sizeof(hook));\n \thook.argv = argv;\n \thook.no_stdin = 1;\n \thook.stdout_to_stderr = 1;\ndiff --git a/builtin-grep.c b/builtin-grep.c\nindex 3a51662..8ac09fb 100644\n--- a/builtin-grep.c\n+++ b/builtin-grep.c\n@@ -512,12 +512,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tint hit = 0;\n \tint cached = 0;\n \tint seen_dashdash = 0;\n-\tstruct grep_opt opt;\n+\tstruct grep_opt opt = { 0, };\n \tstruct object_array list = { 0, 0, NULL };\n \tconst char **paths = NULL;\n \tint i;\n \n-\tmemset(&opt, 0, sizeof(opt));\n \topt.prefix_length = (prefix && *prefix) ? strlen(prefix) : 0;\n \topt.relative = 1;\n \topt.pathname = 1;\ndiff --git a/builtin-help.c b/builtin-help.c\nindex 64207cb..cb97f52 100644\n--- a/builtin-help.c\n+++ b/builtin-help.c\n@@ -71,12 +71,11 @@ static const char *get_man_viewer_info(const char *name)\n static int check_emacsclient_version(void)\n {\n \tstruct strbuf buffer = STRBUF_INIT;\n-\tstruct child_process ec_process;\n+\tstruct child_process ec_process = { 0, };\n \tconst char *argv_ec[] = { \"emacsclient\", \"--version\", NULL };\n \tint version;\n \n \t/* emacsclient prints its version number on stderr */\n-\tmemset(&ec_process, 0, sizeof(ec_process));\n \tec_process.argv = argv_ec;\n \tec_process.err = -1;\n \tec_process.stdout_to_stderr = 1;\ndiff --git a/builtin-log.c b/builtin-log.c\nindex fc5e4da..4f4b15d 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -143,7 +143,7 @@ static void early_output(int signal)\n \n static void setup_early_output(struct rev_info *rev)\n {\n-\tstruct sigaction sa;\n+\tstruct sigaction sa = { { 0, }, };\n \n \t/*\n \t * Set up the signal handler, minimally intrusively:\n@@ -152,7 +152,6 @@ static void setup_early_output(struct rev_info *rev)\n \t * system dependencies and headers), and using\n \t * SA_RESTART.\n \t */\n-\tmemset(&sa, 0, sizeof(sa));\n \tsa.sa_handler = early_output;\n \tsigemptyset(&sa.sa_mask);\n \tsa.sa_flags = SA_RESTART;\ndiff --git a/builtin-ls-files.c b/builtin-ls-files.c\nindex 068f424..45ca899 100644\n--- a/builtin-ls-files.c\n+++ b/builtin-ls-files.c\n@@ -432,9 +432,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)\n {\n \tint i;\n \tint exc_given = 0, require_work_tree = 0;\n-\tstruct dir_struct dir;\n+\tstruct dir_struct dir = { 0, };\n \n-\tmemset(&dir, 0, sizeof(dir));\n \tif (prefix)\n \t\tprefix_offset = strlen(prefix);\n \tgit_config(git_default_config, NULL);\ndiff --git a/builtin-merge.c b/builtin-merge.c\nindex dcf8987..ef96078 100644\n--- a/builtin-merge.c\n+++ b/builtin-merge.c\n@@ -91,10 +91,9 @@ static struct strategy *get_strategy(const char *name)\n \t\t\treturn &all_strategy[i];\n \n \tif (!loaded) {\n-\t\tstruct cmdnames not_strategies;\n+\t\tstruct cmdnames not_strategies = { 0, };\n \t\tloaded = 1;\n \n-\t\tmemset(&not_strategies, 0, sizeof(struct cmdnames));\n \t\tload_command_list(\"git-merge-\", &main_cmds, &other_cmds);\n \t\tfor (i = 0; i < main_cmds.cnt; i++) {\n \t\t\tint j, found = 0;\n@@ -184,11 +183,10 @@ static void drop_save(void)\n static void save_state(void)\n {\n \tint len;\n-\tstruct child_process cp;\n+\tstruct child_process cp = { 0, };\n \tstruct strbuf buffer = STRBUF_INIT;\n \tconst char *argv[] = {\"stash\", \"create\", NULL};\n \n-\tmemset(&cp, 0, sizeof(cp));\n \tcp.argv = argv;\n \tcp.out = -1;\n \tcp.git_cmd = 1;\n@@ -298,7 +296,7 @@ static void squash_message(void)\n \n static int run_hook(const char *name)\n {\n-\tstruct child_process hook;\n+\tstruct child_process hook = { 0, };\n \tconst char *argv[3], *env[2];\n \tchar index[PATH_MAX];\n \n@@ -316,7 +314,6 @@ static int run_hook(const char *name)\n \t\targv[1] = \"0\";\n \targv[2] = NULL;\n \n-\tmemset(&hook, 0, sizeof(hook));\n \thook.argv = argv;\n \thook.no_stdin = 1;\n \thook.stdout_to_stderr = 1;\n@@ -379,12 +376,11 @@ static void finish(const unsigned char *new_head, const char *msg)\n static void merge_name(const char *remote, struct strbuf *msg)\n {\n \tstruct object *remote_head;\n-\tunsigned char branch_head[20], buf_sha[20];\n+\tunsigned char branch_head[20] = { 0, }, buf_sha[20];\n \tstruct strbuf buf;\n \tconst char *ptr;\n \tint len, early;\n \n-\tmemset(branch_head, 0, sizeof(branch_head));\n \tremote_head = peel_to_type(remote, 0, NULL, OBJ_COMMIT);\n \tif (!remote_head)\n \t\tdie(\"'%s' does not point to a commit\", remote);\n@@ -503,9 +499,8 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,\n \tint i, nr_trees = 0;\n \tstruct tree *trees[MAX_UNPACK_TREES];\n \tstruct tree_desc t[MAX_UNPACK_TREES];\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = 2;\n \topts.src_index = &the_index;\n \topts.dst_index = &the_index;\n@@ -630,21 +625,17 @@ static int count_unmerged_entries(void)\n \n static int checkout_fast_forward(unsigned char *head, unsigned char *remote)\n {\n-\tstruct tree *trees[MAX_UNPACK_TREES];\n-\tstruct unpack_trees_options opts;\n-\tstruct tree_desc t[MAX_UNPACK_TREES];\n+\tstruct tree *trees[MAX_UNPACK_TREES] = { 0, };\n+\tstruct unpack_trees_options opts = { 0, };\n+\tstruct tree_desc t[MAX_UNPACK_TREES] = { { 0, }, };\n \tint i, fd, nr_trees = 0;\n-\tstruct dir_struct dir;\n+\tstruct dir_struct dir = { 0, };\n \tstruct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));\n \n \trefresh_cache(REFRESH_QUIET);\n \n \tfd = hold_locked_index(lock_file, 1);\n \n-\tmemset(&trees, 0, sizeof(trees));\n-\tmemset(&opts, 0, sizeof(opts));\n-\tmemset(&t, 0, sizeof(t));\n-\tmemset(&dir, 0, sizeof(dir));\n \tdir.show_ignored = 1;\n \tdir.exclude_per_dir = \".gitignore\";\n \topts.dir = &dir;\n@@ -706,7 +697,6 @@ static void add_strategies(const char *string, unsigned attr)\n \tstruct strategy *list = NULL;\n \tint list_alloc = 0, list_nr = 0, i;\n \n-\tmemset(&list, 0, sizeof(list));\n \tsplit_merge_strategies(string, &list, &list_nr, &list_alloc);\n \tif (list) {\n \t\tfor (i = 0; i < list_nr; i++)\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 59c30d1..c9b37c2 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -128,11 +128,10 @@ static void *get_delta(struct object_entry *entry)\n \n static unsigned long do_compress(void **pptr, unsigned long size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tvoid *in, *out;\n \tunsigned long maxsize;\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, pack_compression_level);\n \tmaxsize = deflateBound(&stream, size);\n \n@@ -189,11 +188,10 @@ static int check_pack_inflate(struct packed_git *p,\n \t\toff_t len,\n \t\tunsigned long expect)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tunsigned char fakebuf[4096], *in;\n \tint st;\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tinflateInit(&stream);\n \tdo {\n \t\tin = use_pack(p, w_curs, offset, &stream.avail_in);\n@@ -1896,11 +1894,9 @@ static int ofscmp(const void *a_, const void *b_)\n static void add_objects_in_unpacked_packs(struct rev_info *revs)\n {\n \tstruct packed_git *p;\n-\tstruct in_pack in_pack;\n+\tstruct in_pack in_pack = { 0, };\n \tuint32_t i;\n \n-\tmemset(&in_pack, 0, sizeof(in_pack));\n-\n \tfor (p = packed_git; p; p = p->next) {\n \t\tconst unsigned char *sha1;\n \t\tstruct object *o;\ndiff --git a/builtin-read-tree.c b/builtin-read-tree.c\nindex 0706c95..d518bc4 100644\n--- a/builtin-read-tree.c\n+++ b/builtin-read-tree.c\n@@ -73,9 +73,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)\n \tint i, newfd, stage = 0;\n \tunsigned char sha1[20];\n \tstruct tree_desc t[MAX_UNPACK_TREES];\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = -1;\n \topts.src_index = &the_index;\n \topts.dst_index = &the_index;\ndiff --git a/builtin-receive-pack.c b/builtin-receive-pack.c\nindex 45e3cd9..2a26851 100644\n--- a/builtin-receive-pack.c\n+++ b/builtin-receive-pack.c\n@@ -107,7 +107,7 @@ static int run_hook(const char *hook_name)\n {\n \tstatic char buf[sizeof(commands->old_sha1) * 2 + PATH_MAX + 4];\n \tstruct command *cmd;\n-\tstruct child_process proc;\n+\tstruct child_process proc = { 0, };\n \tconst char *argv[2];\n \tint have_input = 0, code;\n \n@@ -122,7 +122,6 @@ static int run_hook(const char *hook_name)\n \targv[0] = hook_name;\n \targv[1] = NULL;\n \n-\tmemset(&proc, 0, sizeof(proc));\n \tproc.argv = argv;\n \tproc.in = -1;\n \tproc.stdout_to_stderr = 1;\n@@ -147,7 +146,7 @@ static int run_hook(const char *hook_name)\n static int run_update_hook(struct command *cmd)\n {\n \tstatic const char update_hook[] = \"hooks/update\";\n-\tstruct child_process proc;\n+\tstruct child_process proc = { 0, };\n \tconst char *argv[5];\n \n \tif (access(update_hook, X_OK) < 0)\n@@ -159,7 +158,6 @@ static int run_update_hook(struct command *cmd)\n \targv[3] = sha1_to_hex(cmd->new_sha1);\n \targv[4] = NULL;\n \n-\tmemset(&proc, 0, sizeof(proc));\n \tproc.argv = argv;\n \tproc.no_stdin = 1;\n \tproc.stdout_to_stderr = 1;\n@@ -407,7 +405,7 @@ static const char *unpack(void)\n \t\tconst char *keeper[7];\n \t\tint s, status, i = 0;\n \t\tchar keep_arg[256];\n-\t\tstruct child_process ip;\n+\t\tstruct child_process ip = { 0, };\n \n \t\ts = sprintf(keep_arg, \"--keep=receive-pack %\"PRIuMAX\" on \", (uintmax_t) getpid());\n \t\tif (gethostname(keep_arg + s, sizeof(keep_arg) - s))\n@@ -421,7 +419,6 @@ static const char *unpack(void)\n \t\tkeeper[i++] = hdr_arg;\n \t\tkeeper[i++] = keep_arg;\n \t\tkeeper[i++] = NULL;\n-\t\tmemset(&ip, 0, sizeof(ip));\n \t\tip.argv = keeper;\n \t\tip.out = -1;\n \t\tip.git_cmd = 1;\ndiff --git a/builtin-reflog.c b/builtin-reflog.c\nindex 6b3667e..0bde849 100644\n--- a/builtin-reflog.c\n+++ b/builtin-reflog.c\n@@ -98,8 +98,8 @@ static int tree_is_complete(const unsigned char *sha1)\n \n static int commit_is_complete(struct commit *commit)\n {\n-\tstruct object_array study;\n-\tstruct object_array found;\n+\tstruct object_array study = { 0, };\n+\tstruct object_array found = { 0, };\n \tint is_incomplete = 0;\n \tint i;\n \n@@ -115,8 +115,6 @@ static int commit_is_complete(struct commit *commit)\n \t * If some of the objects that are needed to complete this\n \t * commit are missing, mark this commit as INCOMPLETE.\n \t */\n-\tmemset(&study, 0, sizeof(study));\n-\tmemset(&found, 0, sizeof(found));\n \tadd_object_array(&commit->object, NULL, &study);\n \tadd_object_array(&commit->object, NULL, &found);\n \tcommit->object.flags |= STUDYING;\n@@ -263,13 +261,11 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,\n static int expire_reflog(const char *ref, const unsigned char *sha1, int unused, void *cb_data)\n {\n \tstruct cmd_reflog_expire_cb *cmd = cb_data;\n-\tstruct expire_reflog_cb cb;\n+\tstruct expire_reflog_cb cb = { 0, };\n \tstruct ref_lock *lock;\n \tchar *log_file, *newlog_path = NULL;\n \tint status = 0;\n \n-\tmemset(&cb, 0, sizeof(cb));\n-\n \t/*\n \t * we take the lock for the ref itself to prevent it from\n \t * getting updated.\n@@ -461,7 +457,7 @@ static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, int slot, c\n \n static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)\n {\n-\tstruct cmd_reflog_expire_cb cb;\n+\tstruct cmd_reflog_expire_cb cb = { { 0, }, };\n \tunsigned long now = time(NULL);\n \tint i, status, do_all;\n \tint explicit_expiry = 0;\n@@ -470,7 +466,6 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)\n \n \tsave_commit_buffer = 0;\n \tdo_all = status = 0;\n-\tmemset(&cb, 0, sizeof(cb));\n \n \tif (!default_reflog_expire_unreachable)\n \t\tdefault_reflog_expire_unreachable = now - 30 * 24 * 3600;\n@@ -526,10 +521,9 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (do_all) {\n-\t\tstruct collect_reflog_cb collected;\n+\t\tstruct collect_reflog_cb collected = { 0, };\n \t\tint i;\n \n-\t\tmemset(&collected, 0, sizeof(collected));\n \t\tfor_each_reflog(collect_reflog, &collected);\n \t\tfor (i = 0; i < collected.nr; i++) {\n \t\t\tstruct collected_reflog *e = collected.e[i];\n@@ -565,11 +559,9 @@ static int count_reflog_ent(unsigned char *osha1, unsigned char *nsha1,\n \n static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)\n {\n-\tstruct cmd_reflog_expire_cb cb;\n+\tstruct cmd_reflog_expire_cb cb = { { 0, }, };\n \tint i, status = 0;\n \n-\tmemset(&cb, 0, sizeof(cb));\n-\n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tif (!strcmp(arg, \"--dry-run\") || !strcmp(arg, \"-n\"))\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 90a4e35..883e6d4 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -216,9 +216,8 @@ static int handle_one_branch(const char *refname,\n \tconst unsigned char *sha1, int flags, void *cb_data)\n {\n \tstruct ref_states *states = cb_data;\n-\tstruct refspec refspec;\n+\tstruct refspec refspec = { 0, };\n \n-\tmemset(&refspec, 0, sizeof(refspec));\n \trefspec.dst = (char *)refname;\n \tif (!remote_find_tracking(states->remote, &refspec)) {\n \t\tstruct string_list_item *item;\n@@ -304,11 +303,10 @@ static int add_branch_for_removal(const char *refname,\n \tconst unsigned char *sha1, int flags, void *cb_data)\n {\n \tstruct branches_for_remote *branches = cb_data;\n-\tstruct refspec refspec;\n+\tstruct refspec refspec = { 0, };\n \tstruct string_list_item *item;\n \tstruct known_remote *kr;\n \n-\tmemset(&refspec, 0, sizeof(refspec));\n \trefspec.dst = (char *)refname;\n \tif (remote_find_tracking(branches->remote, &refspec))\n \t\treturn 0;\n@@ -451,9 +449,8 @@ static int append_ref_to_tracked_list(const char *refname,\n \tconst unsigned char *sha1, int flags, void *cb_data)\n {\n \tstruct ref_states *states = cb_data;\n-\tstruct refspec refspec;\n+\tstruct refspec refspec = { 0, };\n \n-\tmemset(&refspec, 0, sizeof(refspec));\n \trefspec.dst = (char *)refname;\n \tif (!remote_find_tracking(states->remote, &refspec))\n \t\tstring_list_append(abbrev_branch(refspec.src), &states->tracked);\n@@ -469,14 +466,13 @@ static int show(int argc, const char **argv)\n \t\tOPT_BOOLEAN('n', NULL, &no_query, \"do not query remotes\"),\n \t\tOPT_END()\n \t};\n-\tstruct ref_states states;\n+\tstruct ref_states states = { 0, };\n \n \targc = parse_options(argc, argv, options, builtin_remote_usage, 0);\n \n \tif (argc < 1)\n \t\treturn show_all();\n \n-\tmemset(&states, 0, sizeof(states));\n \tfor (; argc; argc--, argv++) {\n \t\tint i;\n \n@@ -545,14 +541,13 @@ static int prune(int argc, const char **argv)\n \t\tOPT__DRY_RUN(&dry_run),\n \t\tOPT_END()\n \t};\n-\tstruct ref_states states;\n+\tstruct ref_states states = { 0, };\n \n \targc = parse_options(argc, argv, options, builtin_remote_usage, 0);\n \n \tif (argc < 1)\n \t\tusage_with_options(builtin_remote_usage, options);\n \n-\tmemset(&states, 0, sizeof(states));\n \tfor (; argc; argc--, argv++) {\n \t\tint i;\n \ndiff --git a/builtin-rerere.c b/builtin-rerere.c\nindex dd4573f..45663f6 100644\n--- a/builtin-rerere.c\n+++ b/builtin-rerere.c\n@@ -89,7 +89,7 @@ static int diff_two(const char *file1, const char *label1,\n \t\tconst char *file2, const char *label2)\n {\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \txdemitcb_t ecb;\n \tmmfile_t minus, plus;\n \n@@ -99,7 +99,6 @@ static int diff_two(const char *file1, const char *label1,\n \tprintf(\"--- a/%s\\n+++ b/%s\\n\", label1, label2);\n \tfflush(stdout);\n \txpp.flags = XDF_NEED_MINIMAL;\n-\tmemset(&xecfg, 0, sizeof(xecfg));\n \txecfg.ctxlen = 3;\n \tecb.outf = outf;\n \txdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);\ndiff --git a/builtin-reset.c b/builtin-reset.c\nindex 16e6bb2..fef9727 100644\n--- a/builtin-reset.c\n+++ b/builtin-reset.c\n@@ -136,9 +136,8 @@ static int read_from_tree(const char *prefix, const char **argv,\n {\n \tstruct lock_file *lock = xcalloc(1, sizeof(struct lock_file));\n \tint index_fd, index_was_discarded = 0;\n-\tstruct diff_options opt;\n+\tstruct diff_options opt = { 0, };\n \n-\tmemset(&opt, 0, sizeof(opt));\n \tdiff_tree_setup_paths(get_pathspec(prefix, (const char **)argv), &opt);\n \topt.output_format = DIFF_FORMAT_CALLBACK;\n \topt.format_callback = update_index_from_diff;\ndiff --git a/builtin-send-pack.c b/builtin-send-pack.c\nindex 910db92..cb3f811 100644\n--- a/builtin-send-pack.c\n+++ b/builtin-send-pack.c\n@@ -33,13 +33,12 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext\n \t\tNULL,\n \t\tNULL,\n \t};\n-\tstruct child_process po;\n+\tstruct child_process po = { 0, };\n \tint i;\n \tchar buf[42];\n \n \tif (args.use_thin_pack)\n \t\targv[4] = \"--thin\";\n-\tmemset(&po, 0, sizeof(po));\n \tpo.argv = argv;\n \tpo.in = -1;\n \tpo.out = fd;\n@@ -389,9 +388,8 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest\n \tint expect_status_report = 0;\n \tint flags = MATCH_REFS_NONE;\n \tint ret;\n-\tstruct extra_have_objects extra_have;\n+\tstruct extra_have_objects extra_have = { 0, };\n \n-\tmemset(&extra_have, 0, sizeof(extra_have));\n \tif (args.send_all)\n \t\tflags |= MATCH_REFS_ALL;\n \tif (args.send_mirror)\ndiff --git a/builtin-tag.c b/builtin-tag.c\nindex f2853d0..084970b 100644\n--- a/builtin-tag.c\n+++ b/builtin-tag.c\n@@ -145,7 +145,7 @@ static int verify_tag(const char *name, const char *ref,\n \n static int do_sign(struct strbuf *buffer)\n {\n-\tstruct child_process gpg;\n+\tstruct child_process gpg = { 0, };\n \tconst char *args[4];\n \tchar *bracket;\n \tint len;\n@@ -164,7 +164,6 @@ static int do_sign(struct strbuf *buffer)\n \t * because gpg exits without reading and then write gets SIGPIPE. */\n \tsignal(SIGPIPE, SIG_IGN);\n \n-\tmemset(&gpg, 0, sizeof(gpg));\n \tgpg.argv = args;\n \tgpg.in = -1;\n \tgpg.out = -1;\ndiff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c\nindex 9f4bdd3..8ae199d 100644\n--- a/builtin-unpack-objects.c\n+++ b/builtin-unpack-objects.c\n@@ -90,11 +90,9 @@ static void use(int bytes)\n \n static void *get_data(unsigned long size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tvoid *buf = xmalloc(size);\n \n-\tmemset(&stream, 0, sizeof(stream));\n-\n \tstream.next_out = buf;\n \tstream.avail_out = size;\n \tstream.next_in = fill(1);\ndiff --git a/builtin-verify-tag.c b/builtin-verify-tag.c\nindex 729a159..62aca43 100644\n--- a/builtin-verify-tag.c\n+++ b/builtin-verify-tag.c\n@@ -18,7 +18,7 @@ static const char builtin_verify_tag_usage[] =\n \n static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n {\n-\tstruct child_process gpg;\n+\tstruct child_process gpg = { 0, };\n \tconst char *args_gpg[] = {\"gpg\", \"--verify\", \"FILE\", \"-\", NULL};\n \tchar path[PATH_MAX], *eol;\n \tsize_t len;\n@@ -42,7 +42,6 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose)\n \tif (verbose)\n \t\twrite_in_full(1, buf, len);\n \n-\tmemset(&gpg, 0, sizeof(gpg));\n \tgpg.argv = args_gpg;\n \tgpg.in = -1;\n \targs_gpg[2] = path;\ndiff --git a/bundle.c b/bundle.c\nindex 00b2aab..1e3d446 100644\n--- a/bundle.c\n+++ b/bundle.c\n@@ -99,7 +99,7 @@ int verify_bundle(struct bundle_header *header, int verbose)\n \tstruct ref_list *p = &header->prerequisites;\n \tstruct rev_info revs;\n \tconst char *argv[] = {NULL, \"--all\"};\n-\tstruct object_array refs;\n+\tstruct object_array refs = { 0, };\n \tstruct commit *commit;\n \tint i, ret = 0, req_nr;\n \tconst char *message = \"Repository lacks these prerequisite commits:\";\n@@ -122,7 +122,6 @@ int verify_bundle(struct bundle_header *header, int verbose)\n \treq_nr = revs.pending.nr;\n \tsetup_revisions(2, argv, &revs, NULL);\n \n-\tmemset(&refs, 0, sizeof(struct object_array));\n \tfor (i = 0; i < revs.pending.nr; i++) {\n \t\tstruct object_array_entry *e = revs.pending.objects + i;\n \t\tadd_object_array(e->item, e->name, &refs);\n@@ -179,7 +178,7 @@ int create_bundle(struct bundle_header *header, const char *path,\n \tchar buffer[1024];\n \tstruct rev_info revs;\n \tint read_from_stdin = 0;\n-\tstruct child_process rls;\n+\tstruct child_process rls = { 0, };\n \tFILE *rls_fout;\n \n \tbundle_to_stdout = !strcmp(path, \"-\");\n@@ -201,7 +200,6 @@ int create_bundle(struct bundle_header *header, const char *path,\n \targv_boundary[1] = \"--boundary\";\n \targv_boundary[2] = \"--pretty=oneline\";\n \targv_boundary[argc + 2] = NULL;\n-\tmemset(&rls, 0, sizeof(rls));\n \trls.argv = argv_boundary;\n \trls.out = -1;\n \trls.git_cmd = 1;\n@@ -354,11 +352,10 @@ int unbundle(struct bundle_header *header, int bundle_fd)\n {\n \tconst char *argv_index_pack[] = {\"index-pack\",\n \t\t\"--fix-thin\", \"--stdin\", NULL};\n-\tstruct child_process ip;\n+\tstruct child_process ip = { 0, };\n \n \tif (verify_bundle(header, 0))\n \t\treturn -1;\n-\tmemset(&ip, 0, sizeof(ip));\n \tip.argv = argv_index_pack;\n \tip.in = bundle_fd;\n \tip.no_stdout = 1;\ndiff --git a/combine-diff.c b/combine-diff.c\nindex de83c69..42f28bc 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -202,10 +202,10 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,\n \tunsigned int p_lno, lno;\n \tunsigned long nmask = (1UL << n);\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \tmmfile_t parent_file;\n \txdemitcb_t ecb;\n-\tstruct combine_diff_state state;\n+\tstruct combine_diff_state state = { 0, };\n \tunsigned long sz;\n \n \tif (!cnt)\n@@ -214,8 +214,6 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,\n \tparent_file.ptr = grab_blob(parent, &sz);\n \tparent_file.size = sz;\n \txpp.flags = XDF_NEED_MINIMAL;\n-\tmemset(&xecfg, 0, sizeof(xecfg));\n-\tmemset(&state, 0, sizeof(state));\n \tstate.nmask = nmask;\n \tstate.sline = sline;\n \tstate.lno = 1;\ndiff --git a/connect.c b/connect.c\nindex 67d2cd8..59bd865 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -198,7 +198,7 @@ static int git_tcp_connect_sock(char *host, int flags)\n \tint sockfd = -1, saved_errno = 0;\n \tchar *colon, *end;\n \tconst char *port = STR(DEFAULT_GIT_PORT);\n-\tstruct addrinfo hints, *ai0, *ai;\n+\tstruct addrinfo hints = { 0, }, *ai0, *ai;\n \tint gai;\n \tint cnt = 0;\n \n@@ -221,7 +221,6 @@ static int git_tcp_connect_sock(char *host, int flags)\n \t\t\tport = \"<none>\";\n \t}\n \n-\tmemset(&hints, 0, sizeof(hints));\n \thints.ai_socktype = SOCK_STREAM;\n \thints.ai_protocol = IPPROTO_TCP;\n \n@@ -437,7 +436,7 @@ static void git_proxy_connect(int fd[2], char *host)\n \tconst char *port = STR(DEFAULT_GIT_PORT);\n \tchar *colon, *end;\n \tconst char *argv[4];\n-\tstruct child_process proxy;\n+\tstruct child_process proxy = { 0, };\n \n \tif (host[0] == '[') {\n \t\tend = strchr(host + 1, ']');\n@@ -460,7 +459,6 @@ static void git_proxy_connect(int fd[2], char *host)\n \targv[1] = host;\n \targv[2] = port;\n \targv[3] = NULL;\n-\tmemset(&proxy, 0, sizeof(proxy));\n \tproxy.argv = argv;\n \tproxy.in = -1;\n \tproxy.out = -1;\ndiff --git a/convert.c b/convert.c\nindex 78efed8..a2655bd 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -246,12 +246,11 @@ static int filter_buffer(int fd, void *data)\n \t/*\n \t * Spawn cmd and feed the buffer contents through its stdin.\n \t */\n-\tstruct child_process child_process;\n+\tstruct child_process child_process = { 0, };\n \tstruct filter_params *params = (struct filter_params *)data;\n \tint write_err, status;\n \tconst char *argv[] = { \"sh\", \"-c\", params->cmd, NULL };\n \n-\tmemset(&child_process, 0, sizeof(child_process));\n \tchild_process.argv = argv;\n \tchild_process.in = -1;\n \tchild_process.out = fd;\n@@ -282,13 +281,12 @@ static int apply_filter(const char *path, const char *src, size_t len,\n \t */\n \tint ret = 1;\n \tstruct strbuf nbuf;\n-\tstruct async async;\n+\tstruct async async = { 0, };\n \tstruct filter_params params;\n \n \tif (!cmd)\n \t\treturn 0;\n \n-\tmemset(&async, 0, sizeof(async));\n \tasync.proc = filter_buffer;\n \tasync.data = &params;\n \tparams.src = src;\ndiff --git a/daemon.c b/daemon.c\nindex 3e5582d..4e62821 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -462,12 +462,11 @@ static void fill_in_extra_table_entries(struct interp *itable)\n \t */\n #ifndef NO_IPV6\n \t{\n-\t\tstruct addrinfo hints;\n+\t\tstruct addrinfo hints = { 0, };\n \t\tstruct addrinfo *ai, *ai0;\n \t\tint gai;\n \t\tstatic char addrbuf[HOST_NAME_MAX + 1];\n \n-\t\tmemset(&hints, 0, sizeof(hints));\n \t\thints.ai_flags = AI_CANONNAME;\n \n \t\tgai = getaddrinfo(interp_table[INTERP_SLOT_HOST].value, 0, &hints, &ai0);\n@@ -489,14 +488,13 @@ static void fill_in_extra_table_entries(struct interp *itable)\n #else\n \t{\n \t\tstruct hostent *hent;\n-\t\tstruct sockaddr_in sa;\n+\t\tstruct sockaddr_in sa = { 0, };\n \t\tchar **ap;\n \t\tstatic char addrbuf[HOST_NAME_MAX + 1];\n \n \t\thent = gethostbyname(interp_table[INTERP_SLOT_HOST].value);\n \n \t\tap = hent->h_addr_list;\n-\t\tmemset(&sa, 0, sizeof sa);\n \t\tsa.sin_family = hent->h_addrtype;\n \t\tsa.sin_port = htons(0);\n \t\tmemcpy(&sa.sin_addr, *ap, hent->h_length);\n@@ -722,12 +720,11 @@ static int socksetup(char *listen_addr, int listen_port, int **socklist_p)\n \tint socknum = 0, *socklist = NULL;\n \tint maxfd = -1;\n \tchar pbuf[NI_MAXSERV];\n-\tstruct addrinfo hints, *ai0, *ai;\n+\tstruct addrinfo hints = { 0, }, *ai0, *ai;\n \tint gai;\n \tlong flags;\n \n \tsprintf(pbuf, \"%d\", listen_port);\n-\tmemset(&hints, 0, sizeof(hints));\n \thints.ai_family = AF_UNSPEC;\n \thints.ai_socktype = SOCK_STREAM;\n \thints.ai_protocol = IPPROTO_TCP;\n@@ -793,11 +790,10 @@ static int socksetup(char *listen_addr, int listen_port, int **socklist_p)\n \n static int socksetup(char *listen_addr, int listen_port, int **socklist_p)\n {\n-\tstruct sockaddr_in sin;\n+\tstruct sockaddr_in sin = { 0, };\n \tint sockfd;\n \tlong flags;\n \n-\tmemset(&sin, 0, sizeof sin);\n \tsin.sin_family = AF_INET;\n \tsin.sin_port = htons(listen_port);\n \ndiff --git a/date.c b/date.c\nindex 35a5257..a13d6e2 100644\n--- a/date.c\n+++ b/date.c\n@@ -539,11 +539,10 @@ static int date_string(unsigned long date, int offset, char *buf, int len)\n    (i.e. English) day/month names, and it doesn't work correctly with %z. */\n int parse_date(const char *date, char *result, int maxlen)\n {\n-\tstruct tm tm;\n+\tstruct tm tm = { 0, };\n \tint offset, tm_gmt;\n \ttime_t then;\n \n-\tmemset(&tm, 0, sizeof(tm));\n \ttm.tm_year = -1;\n \ttm.tm_mon = -1;\n \ttm.tm_mday = -1;\ndiff --git a/diff-lib.c b/diff-lib.c\nindex ae96c64..000f100 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -444,7 +444,7 @@ int run_diff_index(struct rev_info *revs, int cached)\n \tstruct object *ent;\n \tstruct tree *tree;\n \tconst char *tree_name;\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \tstruct tree_desc t;\n \tstruct oneway_unpack_data unpack_cb;\n \n@@ -458,7 +458,6 @@ int run_diff_index(struct rev_info *revs, int cached)\n \n \tunpack_cb.revs = revs;\n \tunpack_cb.symcache[0] = '\\0';\n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = 1;\n \topts.index_only = cached;\n \topts.merge = 1;\n@@ -484,7 +483,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)\n \tint i;\n \tstruct cache_entry **dst;\n \tstruct cache_entry *last = NULL;\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \tstruct tree_desc t;\n \tstruct oneway_unpack_data unpack_cb;\n \n@@ -517,7 +516,6 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)\n \n \tunpack_cb.revs = &revs;\n \tunpack_cb.symcache[0] = '\\0';\n-\tmemset(&opts, 0, sizeof(opts));\n \topts.head_idx = 1;\n \topts.index_only = 1;\n \topts.merge = 1;\ndiff --git a/diff.c b/diff.c\nindex 02e948c..5b8e64d 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -466,12 +466,11 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)\n static void diff_words_show(struct diff_words_data *diff_words)\n {\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \txdemitcb_t ecb;\n \tmmfile_t minus, plus;\n \tint i;\n \n-\tmemset(&xecfg, 0, sizeof(xecfg));\n \tminus.size = diff_words->minus.text.size;\n \tminus.ptr = xmalloc(minus.size);\n \tmemcpy(minus.ptr, diff_words->minus.text.ptr, minus.size);\n@@ -1270,9 +1269,8 @@ static unsigned char *deflate_it(char *data,\n {\n \tint bound;\n \tunsigned char *deflated;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, zlib_compression_level);\n \tbound = deflateBound(&stream, size);\n \tdeflated = xmalloc(bound);\n@@ -1569,17 +1567,15 @@ static void builtin_diff(const char *name_a,\n \t\t/* Crazy xdl interfaces.. */\n \t\tconst char *diffopts = getenv(\"GIT_DIFF_OPTS\");\n \t\txpparam_t xpp;\n-\t\txdemitconf_t xecfg;\n+\t\txdemitconf_t xecfg = { 0, };\n \t\txdemitcb_t ecb;\n-\t\tstruct emit_callback ecbdata;\n+\t\tstruct emit_callback ecbdata = { 0, };\n \t\tconst struct funcname_pattern_entry *pe;\n \n \t\tpe = diff_funcname_pattern(one);\n \t\tif (!pe)\n \t\t\tpe = diff_funcname_pattern(two);\n \n-\t\tmemset(&xecfg, 0, sizeof(xecfg));\n-\t\tmemset(&ecbdata, 0, sizeof(ecbdata));\n \t\tecbdata.label_path = lbl;\n \t\tecbdata.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);\n \t\tecbdata.found_changesp = &o->found_changes;\n@@ -1648,10 +1644,9 @@ static void builtin_diffstat(const char *name_a, const char *name_b,\n \t} else {\n \t\t/* Crazy xdl interfaces.. */\n \t\txpparam_t xpp;\n-\t\txdemitconf_t xecfg;\n+\t\txdemitconf_t xecfg = { 0, };\n \t\txdemitcb_t ecb;\n \n-\t\tmemset(&xecfg, 0, sizeof(xecfg));\n \t\txpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;\n \t\txdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,\n \t\t\t      &xpp, &xecfg, &ecb);\n@@ -1669,12 +1664,11 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,\n \t\t\t      struct diff_options *o)\n {\n \tmmfile_t mf1, mf2;\n-\tstruct checkdiff_t data;\n+\tstruct checkdiff_t data = { 0, };\n \n \tif (!two)\n \t\treturn;\n \n-\tmemset(&data, 0, sizeof(data));\n \tdata.filename = name_b ? name_b : name_a;\n \tdata.lineno = 0;\n \tdata.o = o;\n@@ -1694,10 +1688,9 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,\n \telse {\n \t\t/* Crazy xdl interfaces.. */\n \t\txpparam_t xpp;\n-\t\txdemitconf_t xecfg;\n+\t\txdemitconf_t xecfg = { 0, };\n \t\txdemitcb_t ecb;\n \n-\t\tmemset(&xecfg, 0, sizeof(xecfg));\n \t\txecfg.ctxlen = 1; /* at least one context line */\n \t\txpp.flags = XDF_NEED_MINIMAL;\n \t\txdi_diff_outf(&mf1, &mf2, checkdiff_consume, &data,\n@@ -3129,22 +3122,20 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)\n \tstruct diff_queue_struct *q = &diff_queued_diff;\n \tint i;\n \tgit_SHA_CTX ctx;\n-\tstruct patch_id_t data;\n+\tstruct patch_id_t data = { 0, };\n \tchar buffer[PATH_MAX * 4 + 20];\n \n \tgit_SHA1_Init(&ctx);\n-\tmemset(&data, 0, sizeof(struct patch_id_t));\n \tdata.ctx = &ctx;\n \n \tfor (i = 0; i < q->nr; i++) {\n \t\txpparam_t xpp;\n-\t\txdemitconf_t xecfg;\n+\t\txdemitconf_t xecfg = { 0, };\n \t\txdemitcb_t ecb;\n \t\tmmfile_t mf1, mf2;\n \t\tstruct diff_filepair *p = q->queue[i];\n \t\tint len1, len2;\n \n-\t\tmemset(&xecfg, 0, sizeof(xecfg));\n \t\tif (p->status == 0)\n \t\t\treturn error(\"internal diff status error\");\n \t\tif (p->status == DIFF_STATUS_UNKNOWN)\n@@ -3274,9 +3265,8 @@ void diff_flush(struct diff_options *options)\n \t}\n \n \tif (output_format & (DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_SHORTSTAT|DIFF_FORMAT_NUMSTAT)) {\n-\t\tstruct diffstat_t diffstat;\n+\t\tstruct diffstat_t diffstat = { 0, };\n \n-\t\tmemset(&diffstat, 0, sizeof(struct diffstat_t));\n \t\tfor (i = 0; i < q->nr; i++) {\n \t\t\tstruct diff_filepair *p = q->queue[i];\n \t\t\tif (check_pair_status(p))\ndiff --git a/fast-import.c b/fast-import.c\nindex 3c035a5..0dbf329 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1034,7 +1034,7 @@ static int store_object(\n \tunsigned char sha1[20];\n \tunsigned long hdrlen, deltalen;\n \tgit_SHA_CTX c;\n-\tz_stream s;\n+\tz_stream s = { 0, };\n \n \thdrlen = sprintf((char*)hdr,\"%s %lu\", typename(type),\n \t\t(unsigned long)dat->len) + 1;\n@@ -1070,7 +1070,6 @@ static int store_object(\n \t} else\n \t\tdelta = NULL;\n \n-\tmemset(&s, 0, sizeof(s));\n \tdeflateInit(&s, pack_compression_level);\n \tif (delta) {\n \t\ts.next_in = delta;\n@@ -1962,7 +1961,7 @@ static void file_change_cr(struct branch *b, int rename)\n \tstatic struct strbuf s_uq = STRBUF_INIT;\n \tstatic struct strbuf d_uq = STRBUF_INIT;\n \tconst char *endp;\n-\tstruct tree_entry leaf;\n+\tstruct tree_entry leaf = { 0, };\n \n \ts = command_buf.buf + 2;\n \tstrbuf_reset(&s_uq);\n@@ -1989,7 +1988,6 @@ static void file_change_cr(struct branch *b, int rename)\n \t\td = d_uq.buf;\n \t}\n \n-\tmemset(&leaf, 0, sizeof(leaf));\n \tif (rename)\n \t\ttree_content_remove(&b->branch_tree, s, &leaf);\n \telse\ndiff --git a/help.c b/help.c\nindex fd87bb5..cb7d3e6 100644\n--- a/help.c\n+++ b/help.c\n@@ -299,10 +299,8 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)\n const char *help_unknown_cmd(const char *cmd)\n {\n \tint i, n, best_similarity = 0;\n-\tstruct cmdnames main_cmds, other_cmds;\n+\tstruct cmdnames main_cmds = { 0, }, other_cmds = { 0, };\n \n-\tmemset(&main_cmds, 0, sizeof(main_cmds));\n-\tmemset(&other_cmds, 0, sizeof(main_cmds));\n \tmemset(&aliases, 0, sizeof(aliases));\n \n \tgit_config(git_unknown_cmd_config, NULL);\ndiff --git a/http-push.c b/http-push.c\nindex 42f4d78..1bddabd 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -486,13 +486,12 @@ static void start_put(struct transfer_request *request)\n \tunsigned long len;\n \tint hdrlen;\n \tssize_t size;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \n \tunpacked = read_sha1_file(request->obj->sha1, &type, &len);\n \thdrlen = sprintf(hdr, \"%s %lu\", typename(type), len) + 1;\n \n \t/* Set it up */\n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, zlib_compression_level);\n \tsize = deflateBound(&stream, len + hdrlen);\n \tstrbuf_init(&request->buffer.buf, size);\ndiff --git a/imap-send.c b/imap-send.c\nindex af7e08c..700c332 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -981,7 +981,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \tstruct imap *imap;\n \tchar *arg, *rsp;\n \tstruct hostent *he;\n-\tstruct sockaddr_in addr;\n+\tstruct sockaddr_in addr = { 0, };\n \tint s, a[2], preauth;\n \tpid_t pid;\n \n@@ -1019,7 +1019,6 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \n \t\timap_info(\"ok\\n\");\n \t} else {\n-\t\tmemset(&addr, 0, sizeof(addr));\n \t\taddr.sin_port = htons(srvc->port);\n \t\taddr.sin_family = AF_INET;\n \n@@ -1154,15 +1153,13 @@ static int imap_store_msg(struct store *gctx, struct msg_data *data, int *uid)\n {\n \tstruct imap_store *ctx = (struct imap_store *)gctx;\n \tstruct imap *imap = ctx->imap;\n-\tstruct imap_cmd_cb cb;\n+\tstruct imap_cmd_cb cb = { 0, };\n \tchar *fmap, *buf;\n \tconst char *prefix, *box;\n \tint ret, i, j, d, len, extra, nocr;\n \tint start, sbreak = 0, ebreak = 0;\n \tchar flagstr[128], tuid[TUIDL * 2 + 1];\n \n-\tmemset(&cb, 0, sizeof(cb));\n-\n \tfmap = data->data;\n \tlen = data->len;\n \tnocr = !data->crlf;\ndiff --git a/index-pack.c b/index-pack.c\nindex 73860bf..90b2811 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -263,10 +263,9 @@ static void unlink_base_data(struct base_data *c)\n \n static void *unpack_entry_data(unsigned long offset, unsigned long size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tvoid *buf = xmalloc(size);\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tstream.next_out = buf;\n \tstream.avail_out = size;\n \tstream.next_in = fill(1);\n@@ -358,7 +357,7 @@ static void *get_data_from_pack(struct object_entry *obj)\n \tunsigned long len = obj[1].idx.offset - from;\n \tunsigned long rdy = 0;\n \tunsigned char *src, *data;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tint st;\n \n \tsrc = xmalloc(len);\n@@ -373,7 +372,6 @@ static void *get_data_from_pack(struct object_entry *obj)\n \t\trdy += n;\n \t} while (rdy < len);\n \tdata = xmalloc(obj->size);\n-\tmemset(&stream, 0, sizeof(stream));\n \tstream.next_out = data;\n \tstream.avail_out = obj->size;\n \tstream.next_in = src;\n@@ -659,11 +657,10 @@ static void parse_pack_objects(unsigned char *sha1)\n \n static int write_compressed(struct sha1file *f, void *in, unsigned int size)\n {\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tunsigned long maxsize;\n \tvoid *out;\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, zlib_compression_level);\n \tmaxsize = deflateBound(&stream, size);\n \tout = xmalloc(maxsize);\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 4a71614..a81c89b 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -62,7 +62,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,\n \t\t\tmmfile_t *src2, const char *name2,\n \t\t\tint virtual_ancestor)\n {\n-\txpparam_t xpp;\n+\txpparam_t xpp = { 0, };\n \tint style = 0;\n \n \tif (buffer_is_binary(orig->ptr, orig->size) ||\n@@ -77,7 +77,6 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,\n \t\t\t\t       virtual_ancestor);\n \t}\n \n-\tmemset(&xpp, 0, sizeof(xpp));\n \tif (git_xmerge_style >= 0)\n \t\tstyle = git_xmerge_style;\n \treturn xdl_merge(orig,\n@@ -175,7 +174,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,\n \t\t{ \"%A\" },\n \t\t{ \"%B\" },\n \t};\n-\tstruct child_process child;\n+\tstruct child_process child = { 0, };\n \tconst char *args[20];\n \tint status, fd, i;\n \tstruct stat st;\n@@ -195,7 +194,6 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,\n \n \tinterpolate(cmdbuf, sizeof(cmdbuf), fn->cmdline, table, 3);\n \n-\tmemset(&child, 0, sizeof(child));\n \tchild.argv = args;\n \targs[0] = \"sh\";\n \targs[1] = \"-c\";\ndiff --git a/merge-file.c b/merge-file.c\nindex 2a939c9..6e98470 100644\n--- a/merge-file.c\n+++ b/merge-file.c\n@@ -27,10 +27,9 @@ static void free_mmfile(mmfile_t *f)\n static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)\n {\n \tmmbuffer_t res;\n-\txpparam_t xpp;\n+\txpparam_t xpp = { 0, };\n \tint merge_status;\n \n-\tmemset(&xpp, 0, sizeof(xpp));\n \tmerge_status = xdl_merge(base, our, \".our\", their, \".their\",\n \t\t&xpp, XDL_MERGE_ZEALOUS, &res);\n \n@@ -58,11 +57,10 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)\n \tunsigned long size = f1->size < f2->size ? f1->size : f2->size;\n \tvoid *ptr = xmalloc(size);\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \txdemitcb_t ecb;\n \n \txpp.flags = XDF_NEED_MINIMAL;\n-\tmemset(&xecfg, 0, sizeof(xecfg));\n \txecfg.ctxlen = 3;\n \txecfg.flags = XDL_EMIT_COMMON;\n \tecb.outf = common_outf;\ndiff --git a/merge-index.c b/merge-index.c\nindex 7827e87..881ab13 100644\n--- a/merge-index.c\n+++ b/merge-index.c\n@@ -8,8 +8,7 @@ static int err;\n \n static void run_program(void)\n {\n-\tstruct child_process child;\n-\tmemset(&child, 0, sizeof(child));\n+\tstruct child_process child = { 0, };\n \tchild.argv = arguments;\n \tif (run_command(&child)) {\n \t\tif (one_shot) {\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 6bc3eac..4358ecf 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -170,9 +170,8 @@ static int git_merge_trees(int index_only,\n {\n \tint rc;\n \tstruct tree_desc t[3];\n-\tstruct unpack_trees_options opts;\n+\tstruct unpack_trees_options opts = { 0, };\n \n-\tmemset(&opts, 0, sizeof(opts));\n \tif (index_only)\n \t\topts.index_only = 1;\n \telse\ndiff --git a/merge-tree.c b/merge-tree.c\nindex 2d1413e..71ab1be 100644\n--- a/merge-tree.c\n+++ b/merge-tree.c\n@@ -102,11 +102,10 @@ static void show_diff(struct merge_list *entry)\n \tunsigned long size;\n \tmmfile_t src, dst;\n \txpparam_t xpp;\n-\txdemitconf_t xecfg;\n+\txdemitconf_t xecfg = { 0, };\n \txdemitcb_t ecb;\n \n \txpp.flags = XDF_NEED_MINIMAL;\n-\tmemset(&xecfg, 0, sizeof(xecfg));\n \txecfg.ctxlen = 3;\n \tecb.outf = show_outf;\n \tecb.priv = NULL;\ndiff --git a/pack-refs.c b/pack-refs.c\nindex 848d311..cab2eaf 100644\n--- a/pack-refs.c\n+++ b/pack-refs.c\n@@ -84,9 +84,8 @@ static struct lock_file packed;\n int pack_refs(unsigned int flags)\n {\n \tint fd;\n-\tstruct pack_refs_cb_data cbdata;\n+\tstruct pack_refs_cb_data cbdata = { 0, };\n \n-\tmemset(&cbdata, 0, sizeof(cbdata));\n \tcbdata.flags = flags;\n \n \tfd = hold_lock_file_for_update(&packed, git_path(\"packed-refs\"), 1);\ndiff --git a/pretty.c b/pretty.c\nindex 8beafa0..fd6924a 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -626,9 +626,8 @@ void format_commit_message(const struct commit *commit,\n \t\t\t   const void *format, struct strbuf *sb,\n \t\t\t   enum date_mode dmode)\n {\n-\tstruct format_commit_context context;\n+\tstruct format_commit_context context = { 0, };\n \n-\tmemset(&context, 0, sizeof(context));\n \tcontext.commit = commit;\n \tcontext.dmode = dmode;\n \tstrbuf_expand(sb, format, format_commit_item, &context);\ndiff --git a/progress.c b/progress.c\nindex 55a8687..7507dfe 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -44,12 +44,11 @@ static void progress_interval(int signum)\n \n static void set_progress_signal(void)\n {\n-\tstruct sigaction sa;\n+\tstruct sigaction sa = { { 0, }, };\n \tstruct itimerval v;\n \n \tprogress_update = 0;\n \n-\tmemset(&sa, 0, sizeof(sa));\n \tsa.sa_handler = progress_interval;\n \tsigemptyset(&sa.sa_mask);\n \tsa.sa_flags = SA_RESTART;\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 7515987..00049b5 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1297,10 +1297,9 @@ unsigned long get_size_from_delta(struct packed_git *p,\n {\n \tconst unsigned char *data;\n \tunsigned char delta_head[20], *in;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tint st;\n \n-\tmemset(&stream, 0, sizeof(stream));\n \tstream.next_out = delta_head;\n \tstream.avail_out = sizeof(delta_head);\n \n@@ -1511,12 +1510,11 @@ static void *unpack_compressed_entry(struct packed_git *p,\n \t\t\t\t    unsigned long size)\n {\n \tint st;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tunsigned char *buffer, *in;\n \n \tbuffer = xmalloc(size + 1);\n \tbuffer[size] = 0;\n-\tmemset(&stream, 0, sizeof(stream));\n \tstream.next_out = buffer;\n \tstream.avail_out = size;\n \n@@ -2252,7 +2250,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,\n {\n \tint fd, size, ret;\n \tunsigned char *compressed;\n-\tz_stream stream;\n+\tz_stream stream = { 0, };\n \tchar *filename;\n \tstatic char tmpfile[PATH_MAX];\n \n@@ -2266,7 +2264,6 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,\n \t}\n \n \t/* Set it up */\n-\tmemset(&stream, 0, sizeof(stream));\n \tdeflateInit(&stream, zlib_compression_level);\n \tsize = 8 + deflateBound(&stream, len+hdrlen);\n \tcompressed = xmalloc(size);\ndiff --git a/transport.c b/transport.c\nindex 5110c56..ccbb42b 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -41,14 +41,12 @@ static int read_loose_refs(struct strbuf *path, int name_offset,\n \tstruct {\n \t\tchar **entries;\n \t\tint nr, alloc;\n-\t} list;\n+\t} list = { 0, };\n \tint i, pathlen;\n \n \tif (!dir)\n \t\treturn -1;\n \n-\tmemset (&list, 0, sizeof(list));\n-\n \twhile ((de = readdir(dir))) {\n \t\tif (de->d_name[0] == '.' && (de->d_name[1] == '\\0' ||\n \t\t\t\t(de->d_name[1] == '.' &&\n@@ -146,7 +144,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport)\n {\n \tstruct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;\n \tstruct ref dummy, *tail = &dummy;\n-\tstruct child_process rsync;\n+\tstruct child_process rsync = { 0, };\n \tconst char *args[5];\n \tint temp_dir_len;\n \n@@ -160,7 +158,6 @@ static struct ref *get_refs_via_rsync(struct transport *transport)\n \tstrbuf_addstr(&buf, transport->url);\n \tstrbuf_addstr(&buf, \"/refs\");\n \n-\tmemset(&rsync, 0, sizeof(rsync));\n \trsync.argv = args;\n \trsync.stdout_to_stderr = 1;\n \targs[0] = \"rsync\";\n@@ -206,14 +203,13 @@ static int fetch_objs_via_rsync(struct transport *transport,\n \t\t\t\tint nr_objs, const struct ref **to_fetch)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n-\tstruct child_process rsync;\n+\tstruct child_process rsync = { 0, };\n \tconst char *args[8];\n \tint result;\n \n \tstrbuf_addstr(&buf, transport->url);\n \tstrbuf_addstr(&buf, \"/objects/\");\n \n-\tmemset(&rsync, 0, sizeof(rsync));\n \trsync.argv = args;\n \trsync.stdout_to_stderr = 1;\n \targs[0] = \"rsync\";\n@@ -281,7 +277,7 @@ static int rsync_transport_push(struct transport *transport,\n {\n \tstruct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;\n \tint result = 0, i;\n-\tstruct child_process rsync;\n+\tstruct child_process rsync = { 0, };\n \tconst char *args[10];\n \n \tif (flags & TRANSPORT_PUSH_MIRROR)\n@@ -292,7 +288,6 @@ static int rsync_transport_push(struct transport *transport,\n \tstrbuf_addstr(&buf, transport->url);\n \tstrbuf_addch(&buf, '/');\n \n-\tmemset(&rsync, 0, sizeof(rsync));\n \trsync.argv = args;\n \trsync.stdout_to_stderr = 1;\n \ti = 0;\n@@ -632,11 +627,10 @@ static int fetch_refs_via_pack(struct transport *transport,\n \tchar **origh = xmalloc(nr_heads * sizeof(*origh));\n \tconst struct ref *refs;\n \tchar *dest = xstrdup(transport->url);\n-\tstruct fetch_pack_args args;\n+\tstruct fetch_pack_args args = { 0, };\n \tint i;\n \tstruct ref *refs_tmp = NULL;\n \n-\tmemset(&args, 0, sizeof(args));\n \targs.uploadpack = data->uploadpack;\n \targs.keep_pack = data->keep;\n \targs.lock_pack = 1;\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex e59d144..a9d6fe5 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -495,7 +495,7 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,\n \t */\n \tint namelen;\n \tint pos, i;\n-\tstruct dir_struct d;\n+\tstruct dir_struct d = { 0, };\n \tchar *pathbuf;\n \tint cnt = 0;\n \tunsigned char sha1[20];\n@@ -545,7 +545,6 @@ static int verify_clean_subdirectory(struct cache_entry *ce, const char *action,\n \tmemcpy(pathbuf, ce->name, namelen);\n \tstrcpy(pathbuf+namelen, \"/\");\n \n-\tmemset(&d, 0, sizeof(d));\n \tif (o->dir)\n \t\td.exclude_per_dir = o->dir->exclude_per_dir;\n \ti = read_directory(&d, ce->name, pathbuf, namelen+1, NULL);\ndiff --git a/upload-pack.c b/upload-pack.c\nindex e5adbc0..64cbb0a 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -143,7 +143,7 @@ static int do_rev_list(int fd, void *create_full_pack)\n static void create_pack_file(void)\n {\n \tstruct async rev_list;\n-\tstruct child_process pack_objects;\n+\tstruct child_process pack_objects = { 0, };\n \tint create_full_pack = (nr_our_refs == want_obj.nr && !have_obj.nr);\n \tchar data[8193], progress[128];\n \tchar abort_msg[] = \"aborting due to possible repository \"\n@@ -169,7 +169,6 @@ static void create_pack_file(void)\n \t\targv[arg++] = \"--include-tag\";\n \targv[arg++] = NULL;\n \n-\tmemset(&pack_objects, 0, sizeof(pack_objects));\n \tpack_objects.in = rev_list.out;\t/* start_command closes it */\n \tpack_objects.out = -1;\n \tpack_objects.err = -1;\ndiff --git a/wt-status.c b/wt-status.c\nindex 7cf890f..ad8aac5 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -235,7 +235,7 @@ static void wt_status_print_changed(struct wt_status *s)\n \n static void wt_status_print_submodule_summary(struct wt_status *s)\n {\n-\tstruct child_process sm_summary;\n+\tstruct child_process sm_summary = { 0, };\n \tchar summary_limit[64];\n \tchar index[PATH_MAX];\n \tconst char *env[] = { index, NULL };\n@@ -253,7 +253,6 @@ static void wt_status_print_submodule_summary(struct wt_status *s)\n \tsprintf(summary_limit, \"%d\", wt_status_submodule_summary);\n \tsnprintf(index, sizeof(index), \"GIT_INDEX_FILE=%s\", s->index_file);\n \n-\tmemset(&sm_summary, 0, sizeof(sm_summary));\n \tsm_summary.argv = argv;\n \tsm_summary.env = env;\n \tsm_summary.git_cmd = 1;\n@@ -265,13 +264,12 @@ static void wt_status_print_submodule_summary(struct wt_status *s)\n \n static void wt_status_print_untracked(struct wt_status *s)\n {\n-\tstruct dir_struct dir;\n+\tstruct dir_struct dir = { 0, };\n \tint i;\n \tint shown_header = 0;\n \tstruct strbuf buf;\n \n \tstrbuf_init(&buf, 0);\n-\tmemset(&dir, 0, sizeof(dir));\n \n \tif (!s->untracked) {\n \t\tdir.show_other_directories = 1;\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 8bab82e..662e604 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -140,9 +140,8 @@ int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,\n \t\t  xdemitconf_t const *xecfg, xdemitcb_t *xecb)\n {\n \tint ret;\n-\tstruct xdiff_emit_state state;\n+\tstruct xdiff_emit_state state = { 0, };\n \n-\tmemset(&state, 0, sizeof(state));\n \tstate.consume = fn;\n \tstate.consume_callback_data = consume_callback_data;\n \txecb->outf = xdiff_outf;\n-- \n1.6.0.2.468.gd5b83\n"},{"id":"92696","messageId":"20081009191727.GY8203@spearce.org","threadId":"15840","inReplyTo":"NveF6_7LIvvEmRZEvLeTO5lw7EzzmOQkz1WGEMYGSFKDWqSwAeLwBw@cipher.nrlssc.navy.mil","subject":"Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-10-09T19:17:27Z","receivedAt":"2008-10-09T19:17:27Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> wrote:\n> Is there interest in a patch like this?\n\nI think this is not a worthwhile change.\n \n> \"Possible\" benefits:\n> \n>   1) more concise, so it improves readability in most cases\n\nI'm not sure.\n\nMaybe I'm just too used to reading memset(&foo, 0, sizeof(foo)),\nbut {{0},} seems very difficult to read.\n\n>   2) gives compiler more flexibility when optimizing\n\nShouldn't a good C compiler notice something like a memset and inline\nit when possible?  They already can inline strlen on a constant.\n\n> Drawbacks:\n> \n>   1) many lines touched for no functional change\n\nThat's a pretty big drawback.\n\nWhat happens when a struct gets a struct as its first member?\nDo all the {0,} inits for it have to change to {{0,},} ?\n\n-- \nShawn.\n"},{"id":"92697","messageId":"alpine.LFD.2.00.0810091534430.26244@xanadu.home","threadId":"15840","inReplyTo":"NveF6_7LIvvEmRZEvLeTO5lw7EzzmOQkz1WGEMYGSFKDWqSwAeLwBw@cipher.nrlssc.navy.mil","subject":"Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2008-10-09T19:47:52Z","receivedAt":"2008-10-09T19:47:52Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 9 Oct 2008, Brandon Casey wrote:\n\n> \"Possible\" benefits:\n> \n>   1) more concise, so it improves readability in most cases\n>   2) gives compiler more flexibility when optimizing\n\nBeware beware.  At some point this wasn't a gain at all with some gcc \nversions as it was stupid enough to construct a temporary object on the \nstack corresponding to \"{ 0, }\" and afterward do the assignment by \n*copying* this object to a different stack slot corresponding to the \nactual variable instead of constructing the initial value in place.\n\nAlso note that, on the other hand, gcc is smart enough to optimize a \nmemset() using a constant size and value already by doing appropriate \ncode replacement inline.  I've also seen cases where gcc did the \nopposite and replaced an explicit assignment like your patch does with \nan actual call to memset() when optimizing for size.\n\nSo when claiming flexibility for the compiler to better optimize things, \nplease make sure this is really what is happening through assembly dump \ninspection.\n\n\nNicolas\n"},{"id":"92701","messageId":"OyFvwSFhjVWBmuGctgXwtQ_h6P80_eGa3xtRRd1nLTP-oCvddNO_TQ@cipher.nrlssc.navy.mil","threadId":"15840","inReplyTo":"20081009191727.GY8203@spearce.org","subject":"Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-10-09T20:30:53Z","receivedAt":"2008-10-09T20:30:53Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Shawn O. Pearce wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> wrote:\n>> Is there interest in a patch like this?\n> \n> I think this is not a worthwhile change.\n>  \n>> \"Possible\" benefits:\n>>\n>>   1) more concise, so it improves readability in most cases\n> \n> I'm not sure.\n> \n> Maybe I'm just too used to reading memset(&foo, 0, sizeof(foo)),\n\nWell, I don't have to get the sizeof(foo) part right if I use {0,}.\n\n> but {{0},} seems very difficult to read.\n\nIt wouldn't be the first usage in the git source.\n\n>>   2) gives compiler more flexibility when optimizing\n> \n> Shouldn't a good C compiler notice something like a memset and inline\n> it when possible?  They already can inline strlen on a constant.\n\nI'm sure most of them do.\n\n>> Drawbacks:\n>>\n>>   1) many lines touched for no functional change\n> \n> That's a pretty big drawback.\n> \n> What happens when a struct gets a struct as its first member?\n> Do all the {0,} inits for it have to change to {{0,},} ?\n\nyes, if you don't want compiler warnings.\n\n-brandon\n"},{"id":"92703","messageId":"CqZt8k7g-Uov2ItkgRw6K65RC0ee37ZAckIrbwPLNwDiaHtigtevnA@cipher.nrlssc.navy.mil","threadId":"15840","inReplyTo":"alpine.LFD.2.00.0810091534430.26244@xanadu.home","subject":"Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-10-09T20:56:09Z","receivedAt":"2008-10-09T20:56:09Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Nicolas Pitre wrote:\n> On Thu, 9 Oct 2008, Brandon Casey wrote:\n> \n>> \"Possible\" benefits:\n>>\n>>   1) more concise, so it improves readability in most cases\n>>   2) gives compiler more flexibility when optimizing\n> \n> Beware beware.  At some point this wasn't a gain at all with some gcc \n> versions as it was stupid enough to construct a temporary object on the \n> stack corresponding to \"{ 0, }\" and afterward do the assignment by \n> *copying* this object to a different stack slot corresponding to the \n> actual variable instead of constructing the initial value in place.\n> \n> Also note that, on the other hand, gcc is smart enough to optimize a \n> memset() using a constant size and value already by doing appropriate \n> code replacement inline.  I've also seen cases where gcc did the \n> opposite and replaced an explicit assignment like your patch does with \n> an actual call to memset() when optimizing for size.\n\nI'd call that flexibility.\n\n> So when claiming flexibility for the compiler to better optimize things, \n> please make sure this is really what is happening through assembly dump \n> inspection.\n\nI didn't claim the compiler _would_ do a better job at optimizing if\nmemset wasn't used (though my expectation is that it would do no worse,\nand I don't have assembly dumps to back that up). I suggested it could\ngive the compiler more flexibility. In some strange way you seem to\nagree with me and have given 3 examples of ways that compilers may\noptimize static initialization. :)\n\nAnyway, this is a nothing patch. There is no functional change.\nIf readability is not improved, it is not worth applying. Of course, I\ndon't plan on scanning through and converting all of the existing assignments\nwhich use { 0, } to use memset. I find a single step declaration/initialization\nsimpler. Not sure why that seems to be the case in the git source for simple\nvariables but not structures.\n\n-brandon\n"},{"id":"92704","messageId":"alpine.LFD.2.00.0810091701380.26244@xanadu.home","threadId":"15840","inReplyTo":"CqZt8k7g-Uov2ItkgRw6K65RC0ee37ZAckIrbwPLNwDiaHtigtevnA@cipher.nrlssc.navy.mil","subject":"Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2008-10-09T21:12:36Z","receivedAt":"2008-10-09T21:12:36Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 9 Oct 2008, Brandon Casey wrote:\n\n> Nicolas Pitre wrote:\n> > So when claiming flexibility for the compiler to better optimize things, \n> > please make sure this is really what is happening through assembly dump \n> > inspection.\n> \n> I didn't claim the compiler _would_ do a better job at optimizing if\n> memset wasn't used (though my expectation is that it would do no worse,\n> and I don't have assembly dumps to back that up).\n\nMy point is that such expectation might not always be true.\n\n> I suggested it could\n> give the compiler more flexibility. In some strange way you seem to\n> agree with me and have given 3 examples of ways that compilers may\n> optimize static initialization. :)\n\nActually the first example was a case of making things worse.\n\n> Anyway, this is a nothing patch. There is no functional change.\n> If readability is not improved, it is not worth applying. Of course, I\n> don't plan on scanning through and converting all of the existing assignments\n> which use { 0, } to use memset. I find a single step declaration/initialization\n> simpler. Not sure why that seems to be the case in the git source for simple\n> variables but not structures.\n\n... because of that possible gcc making things worse I mentioned.\n\n\nNicolas\n"}]}