{"thread":{"id":"57469","subject":"[PATCH 00/12] c99: use more designated initializers","startedAt":"2022-02-24T09:33:14Z","lastAt":"2022-02-25T00:03:27Z","messageCount":17,"participants":["Ævar Arnfjörð Bjarmason","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"449404","messageId":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":null,"subject":"[PATCH 00/12] c99: use more designated initializers","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:32:55Z","receivedAt":"2022-02-24T09:33:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"A follow-up to 404c4a54624 (Merge branch 'ab/designated-initializers',\n2021-10-11) and a4b9fb6a5cf (Merge branch\n'ab/designated-initializers-more', 2021-10-18). These code readability\nimprovements are something we can allow ourselves now that we have a\nhard dependency on C99.\n\nThese changes merge cleanly with \"seen\", so they should be easy to\ndeal with as far as anything else that's in-flight goes.\n\nÆvar Arnfjörð Bjarmason (12):\n  imap-send.c: use designated initializers for \"struct imap_server_conf\"\n  refs: use designated initializers for \"struct ref_storage_be\"\n  refs: use designated initializers for \"struct ref_iterator_vtable\"\n  trace2: use designated initializers for \"struct tr2_tgt\"\n  trace2: use designated initializers for \"struct tr2_dst\"\n  object-file: use designated initializers for \"struct git_hash_algo\"\n  archive-*.c: use designated initializers for \"struct archiver\"\n  userdiff.c: use designated initializers for \"struct userdiff_driver\"\n  convert.c: use designated initializers for \"struct stream_filter*\"\n  refspec.c: use designated initializers for \"struct refspec_item\"\n  misc *.c: use designated initializers for struct assignments\n  misc *.c: use designated initializers for \"partial\" struct assignments\n\n archive-tar.c           |  6 +--\n archive-zip.c           |  6 +--\n attr.c                  |  2 +-\n builtin/fast-import.c   | 14 +++++--\n convert.c               | 18 ++++-----\n imap-send.c             | 12 +-----\n notes-merge.c           |  1 +\n object-file.c           | 87 +++++++++++++++++++++--------------------\n refs/debug.c            | 55 +++++++++++++-------------\n refs/files-backend.c    | 62 ++++++++++++++---------------\n refs/iterator.c         | 18 ++++-----\n refs/packed-backend.c   | 56 +++++++++++++-------------\n refs/ref-cache.c        |  6 +--\n refspec.c               | 14 +++----\n trace2/tr2_tgt_event.c  | 64 +++++++++++++++---------------\n trace2/tr2_tgt_normal.c | 64 +++++++++++++++---------------\n trace2/tr2_tgt_perf.c   | 64 +++++++++++++++---------------\n userdiff.c              | 36 ++++++++++-------\n 18 files changed, 299 insertions(+), 286 deletions(-)\n\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449405","messageId":"patch-01.12-e4a7054bef4-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 01/12] imap-send.c: use designated initializers for \"struct imap_server_conf\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:32:56Z","receivedAt":"2022-02-24T09:33:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Cut down a lot on the verbosity of the \"server\" assignment in\nimap-send.c using designated initializers, only the \"ssl_verify\"\nmember was being set to a non-NULL non-0 value.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n imap-send.c | 12 +-----------\n 1 file changed, 1 insertion(+), 11 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex e6090a0346a..5ac6fa9c664 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -98,17 +98,7 @@ struct imap_server_conf {\n };\n \n static struct imap_server_conf server = {\n-\tNULL,\t/* name */\n-\tNULL,\t/* tunnel */\n-\tNULL,\t/* host */\n-\t0,\t/* port */\n-\tNULL,\t/* folder */\n-\tNULL,\t/* user */\n-\tNULL,\t/* pass */\n-\t0,   \t/* use_ssl */\n-\t1,   \t/* ssl_verify */\n-\t0,   \t/* use_html */\n-\tNULL,\t/* auth_method */\n+\t.ssl_verify = 1,\n };\n \n struct imap_socket {\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449406","messageId":"patch-02.12-167d4bfdd82-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 02/12] refs: use designated initializers for \"struct ref_storage_be\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:32:57Z","receivedAt":"2022-02-24T09:33:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the definition of the three refs backends we currently carry to\nuse designated initializers.\n\nThe \"= NULL\" assignments being retained here are redundant, and could\nbe removed, but let's keep them for clarity. All of these backends\ndefine almost all fields, so we're not saving much in terms of line\ncount by omitting these, but e.g. for \"refs_be_debug\" it's immediately\napparent that we're omitting \"init\" when comparing its assignment to\nthe others.\n\nThis is a follow-up to similar work merged in bd4232fac33 (Merge\nbranch 'ab/struct-init', 2021-07-16), a4b9fb6a5cf (Merge branch\n'ab/designated-initializers-more', 2021-10-18) and a30321b9eae (Merge\nbranch 'ab/designated-initializers' into\nab/designated-initializers-more, 2021-09-27).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n refs/debug.c          | 50 +++++++++++++++++++++----------------------\n refs/files-backend.c  | 50 +++++++++++++++++++++----------------------\n refs/packed-backend.c | 50 +++++++++++++++++++++----------------------\n 3 files changed, 75 insertions(+), 75 deletions(-)\n\ndiff --git a/refs/debug.c b/refs/debug.c\nindex 2b0771ca53b..c8b52d43a79 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -418,29 +418,29 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,\n }\n \n struct ref_storage_be refs_be_debug = {\n-\tNULL,\n-\t\"debug\",\n-\tNULL,\n-\tdebug_init_db,\n-\tdebug_transaction_prepare,\n-\tdebug_transaction_finish,\n-\tdebug_transaction_abort,\n-\tdebug_initial_transaction_commit,\n-\n-\tdebug_pack_refs,\n-\tdebug_create_symref,\n-\tdebug_delete_refs,\n-\tdebug_rename_ref,\n-\tdebug_copy_ref,\n-\n-\tdebug_ref_iterator_begin,\n-\tdebug_read_raw_ref,\n-\n-\tdebug_reflog_iterator_begin,\n-\tdebug_for_each_reflog_ent,\n-\tdebug_for_each_reflog_ent_reverse,\n-\tdebug_reflog_exists,\n-\tdebug_create_reflog,\n-\tdebug_delete_reflog,\n-\tdebug_reflog_expire,\n+\t.next = NULL,\n+\t.name = \"debug\",\n+\t.init = NULL,\n+\t.init_db = debug_init_db,\n+\t.transaction_prepare = debug_transaction_prepare,\n+\t.transaction_finish = debug_transaction_finish,\n+\t.transaction_abort = debug_transaction_abort,\n+\t.initial_transaction_commit = debug_initial_transaction_commit,\n+\n+\t.pack_refs = debug_pack_refs,\n+\t.create_symref = debug_create_symref,\n+\t.delete_refs = debug_delete_refs,\n+\t.rename_ref = debug_rename_ref,\n+\t.copy_ref = debug_copy_ref,\n+\n+\t.iterator_begin = debug_ref_iterator_begin,\n+\t.read_raw_ref = debug_read_raw_ref,\n+\n+\t.reflog_iterator_begin = debug_reflog_iterator_begin,\n+\t.for_each_reflog_ent = debug_for_each_reflog_ent,\n+\t.for_each_reflog_ent_reverse = debug_for_each_reflog_ent_reverse,\n+\t.reflog_exists = debug_reflog_exists,\n+\t.create_reflog = debug_create_reflog,\n+\t.delete_reflog = debug_delete_reflog,\n+\t.reflog_expire = debug_reflog_expire,\n };\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex f59589d6cce..efc942958ef 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -3269,29 +3269,29 @@ static int files_init_db(struct ref_store *ref_store, struct strbuf *err)\n }\n \n struct ref_storage_be refs_be_files = {\n-\tNULL,\n-\t\"files\",\n-\tfiles_ref_store_create,\n-\tfiles_init_db,\n-\tfiles_transaction_prepare,\n-\tfiles_transaction_finish,\n-\tfiles_transaction_abort,\n-\tfiles_initial_transaction_commit,\n-\n-\tfiles_pack_refs,\n-\tfiles_create_symref,\n-\tfiles_delete_refs,\n-\tfiles_rename_ref,\n-\tfiles_copy_ref,\n-\n-\tfiles_ref_iterator_begin,\n-\tfiles_read_raw_ref,\n-\n-\tfiles_reflog_iterator_begin,\n-\tfiles_for_each_reflog_ent,\n-\tfiles_for_each_reflog_ent_reverse,\n-\tfiles_reflog_exists,\n-\tfiles_create_reflog,\n-\tfiles_delete_reflog,\n-\tfiles_reflog_expire\n+\t.next = NULL,\n+\t.name = \"files\",\n+\t.init = files_ref_store_create,\n+\t.init_db = files_init_db,\n+\t.transaction_prepare = files_transaction_prepare,\n+\t.transaction_finish = files_transaction_finish,\n+\t.transaction_abort = files_transaction_abort,\n+\t.initial_transaction_commit = files_initial_transaction_commit,\n+\n+\t.pack_refs = files_pack_refs,\n+\t.create_symref = files_create_symref,\n+\t.delete_refs = files_delete_refs,\n+\t.rename_ref = files_rename_ref,\n+\t.copy_ref = files_copy_ref,\n+\n+\t.iterator_begin = files_ref_iterator_begin,\n+\t.read_raw_ref = files_read_raw_ref,\n+\n+\t.reflog_iterator_begin = files_reflog_iterator_begin,\n+\t.for_each_reflog_ent = files_for_each_reflog_ent,\n+\t.for_each_reflog_ent_reverse = files_for_each_reflog_ent_reverse,\n+\t.reflog_exists = files_reflog_exists,\n+\t.create_reflog = files_create_reflog,\n+\t.delete_reflog = files_delete_reflog,\n+\t.reflog_expire = files_reflog_expire\n };\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex 27dd8c3922b..ba75c28f1bf 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -1667,29 +1667,29 @@ static int packed_reflog_expire(struct ref_store *ref_store,\n }\n \n struct ref_storage_be refs_be_packed = {\n-\tNULL,\n-\t\"packed\",\n-\tpacked_ref_store_create,\n-\tpacked_init_db,\n-\tpacked_transaction_prepare,\n-\tpacked_transaction_finish,\n-\tpacked_transaction_abort,\n-\tpacked_initial_transaction_commit,\n-\n-\tpacked_pack_refs,\n-\tpacked_create_symref,\n-\tpacked_delete_refs,\n-\tpacked_rename_ref,\n-\tpacked_copy_ref,\n-\n-\tpacked_ref_iterator_begin,\n-\tpacked_read_raw_ref,\n-\n-\tpacked_reflog_iterator_begin,\n-\tpacked_for_each_reflog_ent,\n-\tpacked_for_each_reflog_ent_reverse,\n-\tpacked_reflog_exists,\n-\tpacked_create_reflog,\n-\tpacked_delete_reflog,\n-\tpacked_reflog_expire\n+\t.next = NULL,\n+\t.name = \"packed\",\n+\t.init = packed_ref_store_create,\n+\t.init_db = packed_init_db,\n+\t.transaction_prepare = packed_transaction_prepare,\n+\t.transaction_finish = packed_transaction_finish,\n+\t.transaction_abort = packed_transaction_abort,\n+\t.initial_transaction_commit = packed_initial_transaction_commit,\n+\n+\t.pack_refs = packed_pack_refs,\n+\t.create_symref = packed_create_symref,\n+\t.delete_refs = packed_delete_refs,\n+\t.rename_ref = packed_rename_ref,\n+\t.copy_ref = packed_copy_ref,\n+\n+\t.iterator_begin = packed_ref_iterator_begin,\n+\t.read_raw_ref = packed_read_raw_ref,\n+\n+\t.reflog_iterator_begin = packed_reflog_iterator_begin,\n+\t.for_each_reflog_ent = packed_for_each_reflog_ent,\n+\t.for_each_reflog_ent_reverse = packed_for_each_reflog_ent_reverse,\n+\t.reflog_exists = packed_reflog_exists,\n+\t.create_reflog = packed_create_reflog,\n+\t.delete_reflog = packed_delete_reflog,\n+\t.reflog_expire = packed_reflog_expire\n };\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449407","messageId":"patch-03.12-6693c689936-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 03/12] refs: use designated initializers for \"struct ref_iterator_vtable\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:32:58Z","receivedAt":"2022-02-24T09:33:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n refs/debug.c          |  5 +++--\n refs/files-backend.c  | 12 ++++++------\n refs/iterator.c       | 18 +++++++++---------\n refs/packed-backend.c |  6 +++---\n refs/ref-cache.c      |  6 +++---\n 5 files changed, 24 insertions(+), 23 deletions(-)\n\ndiff --git a/refs/debug.c b/refs/debug.c\nindex c8b52d43a79..c647a20abbd 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -220,8 +220,9 @@ static int debug_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable debug_ref_iterator_vtable = {\n-\tdebug_ref_iterator_advance, debug_ref_iterator_peel,\n-\tdebug_ref_iterator_abort\n+\t.advance = debug_ref_iterator_advance,\n+\t.peel = debug_ref_iterator_peel,\n+\t.abort = debug_ref_iterator_abort,\n };\n \n static struct ref_iterator *\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex efc942958ef..3159be5a37a 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -800,9 +800,9 @@ static int files_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable files_ref_iterator_vtable = {\n-\tfiles_ref_iterator_advance,\n-\tfiles_ref_iterator_peel,\n-\tfiles_ref_iterator_abort\n+\t.advance = files_ref_iterator_advance,\n+\t.peel = files_ref_iterator_peel,\n+\t.abort = files_ref_iterator_abort,\n };\n \n static struct ref_iterator *files_ref_iterator_begin(\n@@ -2209,9 +2209,9 @@ static int files_reflog_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable files_reflog_iterator_vtable = {\n-\tfiles_reflog_iterator_advance,\n-\tfiles_reflog_iterator_peel,\n-\tfiles_reflog_iterator_abort\n+\t.advance = files_reflog_iterator_advance,\n+\t.peel = files_reflog_iterator_peel,\n+\t.abort = files_reflog_iterator_abort,\n };\n \n static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,\ndiff --git a/refs/iterator.c b/refs/iterator.c\nindex a89d132d4fe..b2e56bae1c6 100644\n--- a/refs/iterator.c\n+++ b/refs/iterator.c\n@@ -64,9 +64,9 @@ static int empty_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable empty_ref_iterator_vtable = {\n-\tempty_ref_iterator_advance,\n-\tempty_ref_iterator_peel,\n-\tempty_ref_iterator_abort\n+\t.advance = empty_ref_iterator_advance,\n+\t.peel = empty_ref_iterator_peel,\n+\t.abort = empty_ref_iterator_abort,\n };\n \n struct ref_iterator *empty_ref_iterator_begin(void)\n@@ -201,9 +201,9 @@ static int merge_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable merge_ref_iterator_vtable = {\n-\tmerge_ref_iterator_advance,\n-\tmerge_ref_iterator_peel,\n-\tmerge_ref_iterator_abort\n+\t.advance = merge_ref_iterator_advance,\n+\t.peel = merge_ref_iterator_peel,\n+\t.abort = merge_ref_iterator_abort,\n };\n \n struct ref_iterator *merge_ref_iterator_begin(\n@@ -378,9 +378,9 @@ static int prefix_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable prefix_ref_iterator_vtable = {\n-\tprefix_ref_iterator_advance,\n-\tprefix_ref_iterator_peel,\n-\tprefix_ref_iterator_abort\n+\t.advance = prefix_ref_iterator_advance,\n+\t.peel = prefix_ref_iterator_peel,\n+\t.abort = prefix_ref_iterator_abort,\n };\n \n struct ref_iterator *prefix_ref_iterator_begin(struct ref_iterator *iter0,\ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex ba75c28f1bf..1406cb959c1 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -911,9 +911,9 @@ static int packed_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable packed_ref_iterator_vtable = {\n-\tpacked_ref_iterator_advance,\n-\tpacked_ref_iterator_peel,\n-\tpacked_ref_iterator_abort\n+\t.advance = packed_ref_iterator_advance,\n+\t.peel = packed_ref_iterator_peel,\n+\t.abort = packed_ref_iterator_abort\n };\n \n static struct ref_iterator *packed_ref_iterator_begin(\ndiff --git a/refs/ref-cache.c b/refs/ref-cache.c\nindex be4aa5e0981..3080ef944d9 100644\n--- a/refs/ref-cache.c\n+++ b/refs/ref-cache.c\n@@ -456,9 +456,9 @@ static int cache_ref_iterator_abort(struct ref_iterator *ref_iterator)\n }\n \n static struct ref_iterator_vtable cache_ref_iterator_vtable = {\n-\tcache_ref_iterator_advance,\n-\tcache_ref_iterator_peel,\n-\tcache_ref_iterator_abort\n+\t.advance = cache_ref_iterator_advance,\n+\t.peel = cache_ref_iterator_peel,\n+\t.abort = cache_ref_iterator_abort\n };\n \n struct ref_iterator *cache_ref_iterator_begin(struct ref_cache *cache,\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449408","messageId":"patch-04.12-70aac6263e0-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 04/12] trace2: use designated initializers for \"struct tr2_tgt\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:32:59Z","receivedAt":"2022-02-24T09:33:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As with the preceding commit, change another set of file-level struct\nassignments to use designated initializers.\n\nAs before the \"= NULL\" assignments are redundant, but we're keeping\nthem for self-documentation purposes. The comments left to explain the\npre-image can now be removed in favor of working code that relays the\nsame information to the reader.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n trace2/tr2_tgt_event.c  | 60 ++++++++++++++++++++---------------------\n trace2/tr2_tgt_normal.c | 60 ++++++++++++++++++++---------------------\n trace2/tr2_tgt_perf.c   | 60 ++++++++++++++++++++---------------------\n 3 files changed, 90 insertions(+), 90 deletions(-)\n\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex bd17ecdc321..b5c63622d1e 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -613,34 +613,34 @@ static void fn_data_json_fl(const char *file, int line,\n }\n \n struct tr2_tgt tr2_tgt_event = {\n-\t&tr2dst_event,\n-\n-\tfn_init,\n-\tfn_term,\n-\n-\tfn_version_fl,\n-\tfn_start_fl,\n-\tfn_exit_fl,\n-\tfn_signal,\n-\tfn_atexit,\n-\tfn_error_va_fl,\n-\tfn_command_path_fl,\n-\tfn_command_ancestry_fl,\n-\tfn_command_name_fl,\n-\tfn_command_mode_fl,\n-\tfn_alias_fl,\n-\tfn_child_start_fl,\n-\tfn_child_exit_fl,\n-\tfn_child_ready_fl,\n-\tfn_thread_start_fl,\n-\tfn_thread_exit_fl,\n-\tfn_exec_fl,\n-\tfn_exec_result_fl,\n-\tfn_param_fl,\n-\tfn_repo_fl,\n-\tfn_region_enter_printf_va_fl,\n-\tfn_region_leave_printf_va_fl,\n-\tfn_data_fl,\n-\tfn_data_json_fl,\n-\tNULL, /* printf */\n+\t.pdst = &tr2dst_event,\n+\n+\t.pfn_init = fn_init,\n+\t.pfn_term = fn_term,\n+\n+\t.pfn_version_fl = fn_version_fl,\n+\t.pfn_start_fl = fn_start_fl,\n+\t.pfn_exit_fl = fn_exit_fl,\n+\t.pfn_signal = fn_signal,\n+\t.pfn_atexit = fn_atexit,\n+\t.pfn_error_va_fl = fn_error_va_fl,\n+\t.pfn_command_path_fl = fn_command_path_fl,\n+\t.pfn_command_ancestry_fl = fn_command_ancestry_fl,\n+\t.pfn_command_name_fl = fn_command_name_fl,\n+\t.pfn_command_mode_fl = fn_command_mode_fl,\n+\t.pfn_alias_fl = fn_alias_fl,\n+\t.pfn_child_start_fl = fn_child_start_fl,\n+\t.pfn_child_exit_fl = fn_child_exit_fl,\n+\t.pfn_child_ready_fl = fn_child_ready_fl,\n+\t.pfn_thread_start_fl = fn_thread_start_fl,\n+\t.pfn_thread_exit_fl = fn_thread_exit_fl,\n+\t.pfn_exec_fl = fn_exec_fl,\n+\t.pfn_exec_result_fl = fn_exec_result_fl,\n+\t.pfn_param_fl = fn_param_fl,\n+\t.pfn_repo_fl = fn_repo_fl,\n+\t.pfn_region_enter_printf_va_fl = fn_region_enter_printf_va_fl,\n+\t.pfn_region_leave_printf_va_fl = fn_region_leave_printf_va_fl,\n+\t.pfn_data_fl = fn_data_fl,\n+\t.pfn_data_json_fl = fn_data_json_fl,\n+\t.pfn_printf_va_fl = NULL,\n };\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex 6e429a3fb9e..c7992650018 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -325,34 +325,34 @@ static void fn_printf_va_fl(const char *file, int line,\n }\n \n struct tr2_tgt tr2_tgt_normal = {\n-\t&tr2dst_normal,\n-\n-\tfn_init,\n-\tfn_term,\n-\n-\tfn_version_fl,\n-\tfn_start_fl,\n-\tfn_exit_fl,\n-\tfn_signal,\n-\tfn_atexit,\n-\tfn_error_va_fl,\n-\tfn_command_path_fl,\n-\tfn_command_ancestry_fl,\n-\tfn_command_name_fl,\n-\tfn_command_mode_fl,\n-\tfn_alias_fl,\n-\tfn_child_start_fl,\n-\tfn_child_exit_fl,\n-\tfn_child_ready_fl,\n-\tNULL, /* thread_start */\n-\tNULL, /* thread_exit */\n-\tfn_exec_fl,\n-\tfn_exec_result_fl,\n-\tfn_param_fl,\n-\tfn_repo_fl,\n-\tNULL, /* region_enter */\n-\tNULL, /* region_leave */\n-\tNULL, /* data */\n-\tNULL, /* data_json */\n-\tfn_printf_va_fl,\n+\t.pdst = &tr2dst_normal,\n+\n+\t.pfn_init = fn_init,\n+\t.pfn_term = fn_term,\n+\n+\t.pfn_version_fl = fn_version_fl,\n+\t.pfn_start_fl = fn_start_fl,\n+\t.pfn_exit_fl = fn_exit_fl,\n+\t.pfn_signal = fn_signal,\n+\t.pfn_atexit = fn_atexit,\n+\t.pfn_error_va_fl = fn_error_va_fl,\n+\t.pfn_command_path_fl = fn_command_path_fl,\n+\t.pfn_command_ancestry_fl = fn_command_ancestry_fl,\n+\t.pfn_command_name_fl = fn_command_name_fl,\n+\t.pfn_command_mode_fl = fn_command_mode_fl,\n+\t.pfn_alias_fl = fn_alias_fl,\n+\t.pfn_child_start_fl = fn_child_start_fl,\n+\t.pfn_child_exit_fl = fn_child_exit_fl,\n+\t.pfn_child_ready_fl = fn_child_ready_fl,\n+\t.pfn_thread_start_fl = NULL,\n+\t.pfn_thread_exit_fl = NULL,\n+\t.pfn_exec_fl = fn_exec_fl,\n+\t.pfn_exec_result_fl = fn_exec_result_fl,\n+\t.pfn_param_fl = fn_param_fl,\n+\t.pfn_repo_fl = fn_repo_fl,\n+\t.pfn_region_enter_printf_va_fl = NULL,\n+\t.pfn_region_leave_printf_va_fl = NULL,\n+\t.pfn_data_fl = NULL,\n+\t.pfn_data_json_fl = NULL,\n+\t.pfn_printf_va_fl = fn_printf_va_fl,\n };\ndiff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c\nindex 2ff9cf70835..a2a0195e0f4 100644\n--- a/trace2/tr2_tgt_perf.c\n+++ b/trace2/tr2_tgt_perf.c\n@@ -549,34 +549,34 @@ static void fn_printf_va_fl(const char *file, int line,\n }\n \n struct tr2_tgt tr2_tgt_perf = {\n-\t&tr2dst_perf,\n-\n-\tfn_init,\n-\tfn_term,\n-\n-\tfn_version_fl,\n-\tfn_start_fl,\n-\tfn_exit_fl,\n-\tfn_signal,\n-\tfn_atexit,\n-\tfn_error_va_fl,\n-\tfn_command_path_fl,\n-\tfn_command_ancestry_fl,\n-\tfn_command_name_fl,\n-\tfn_command_mode_fl,\n-\tfn_alias_fl,\n-\tfn_child_start_fl,\n-\tfn_child_exit_fl,\n-\tfn_child_ready_fl,\n-\tfn_thread_start_fl,\n-\tfn_thread_exit_fl,\n-\tfn_exec_fl,\n-\tfn_exec_result_fl,\n-\tfn_param_fl,\n-\tfn_repo_fl,\n-\tfn_region_enter_printf_va_fl,\n-\tfn_region_leave_printf_va_fl,\n-\tfn_data_fl,\n-\tfn_data_json_fl,\n-\tfn_printf_va_fl,\n+\t.pdst = &tr2dst_perf,\n+\n+\t.pfn_init = fn_init,\n+\t.pfn_term = fn_term,\n+\n+\t.pfn_version_fl = fn_version_fl,\n+\t.pfn_start_fl = fn_start_fl,\n+\t.pfn_exit_fl = fn_exit_fl,\n+\t.pfn_signal = fn_signal,\n+\t.pfn_atexit = fn_atexit,\n+\t.pfn_error_va_fl = fn_error_va_fl,\n+\t.pfn_command_path_fl = fn_command_path_fl,\n+\t.pfn_command_ancestry_fl = fn_command_ancestry_fl,\n+\t.pfn_command_name_fl = fn_command_name_fl,\n+\t.pfn_command_mode_fl = fn_command_mode_fl,\n+\t.pfn_alias_fl = fn_alias_fl,\n+\t.pfn_child_start_fl = fn_child_start_fl,\n+\t.pfn_child_exit_fl = fn_child_exit_fl,\n+\t.pfn_child_ready_fl = fn_child_ready_fl,\n+\t.pfn_thread_start_fl = fn_thread_start_fl,\n+\t.pfn_thread_exit_fl = fn_thread_exit_fl,\n+\t.pfn_exec_fl = fn_exec_fl,\n+\t.pfn_exec_result_fl = fn_exec_result_fl,\n+\t.pfn_param_fl = fn_param_fl,\n+\t.pfn_repo_fl = fn_repo_fl,\n+\t.pfn_region_enter_printf_va_fl = fn_region_enter_printf_va_fl,\n+\t.pfn_region_leave_printf_va_fl = fn_region_leave_printf_va_fl,\n+\t.pfn_data_fl = fn_data_fl,\n+\t.pfn_data_json_fl = fn_data_json_fl,\n+\t.pfn_printf_va_fl = fn_printf_va_fl,\n };\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449409","messageId":"patch-05.12-2caa1661da4-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 05/12] trace2: use designated initializers for \"struct tr2_dst\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:00Z","receivedAt":"2022-02-24T09:33:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Convert the \"static struct tr2_dst\" assignments in trace2/* to use\ndesignated initializers. I don't think it improves readability to\ninclude the explicit 0-ing out of the\nfd/initialized/need_close/too_many_files members, so let's have those\nbe initialized implicitly by the compiler.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n trace2/tr2_tgt_event.c  | 4 +++-\n trace2/tr2_tgt_normal.c | 4 +++-\n trace2/tr2_tgt_perf.c   | 4 +++-\n 3 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex b5c63622d1e..c5c8cfbbaa0 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -10,7 +10,9 @@\n #include \"trace2/tr2_tgt.h\"\n #include \"trace2/tr2_tls.h\"\n \n-static struct tr2_dst tr2dst_event = { TR2_SYSENV_EVENT, 0, 0, 0, 0 };\n+static struct tr2_dst tr2dst_event = {\n+\t.sysenv_var = TR2_SYSENV_EVENT,\n+};\n \n /*\n  * The version number of the JSON data generated by the EVENT target in this\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex c7992650018..c42fbade7f0 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -9,7 +9,9 @@\n #include \"trace2/tr2_tgt.h\"\n #include \"trace2/tr2_tls.h\"\n \n-static struct tr2_dst tr2dst_normal = { TR2_SYSENV_NORMAL, 0, 0, 0, 0 };\n+static struct tr2_dst tr2dst_normal = {\n+\t.sysenv_var = TR2_SYSENV_NORMAL,\n+};\n \n /*\n  * Use the TR2_SYSENV_NORMAL_BRIEF setting to omit the \"<time> <file>:<line>\"\ndiff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c\nindex a2a0195e0f4..a1eff8bea31 100644\n--- a/trace2/tr2_tgt_perf.c\n+++ b/trace2/tr2_tgt_perf.c\n@@ -11,7 +11,9 @@\n #include \"trace2/tr2_tgt.h\"\n #include \"trace2/tr2_tls.h\"\n \n-static struct tr2_dst tr2dst_perf = { TR2_SYSENV_PERF, 0, 0, 0, 0 };\n+static struct tr2_dst tr2dst_perf = {\n+\t.sysenv_var = TR2_SYSENV_PERF,\n+};\n \n /*\n  * Use TR2_SYSENV_PERF_BRIEF to omit the \"<time> <file>:<line>\"\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449410","messageId":"patch-06.12-1c213f2b403-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 06/12] object-file: use designated initializers for \"struct git_hash_algo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:01Z","receivedAt":"2022-02-24T09:33:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As with the preceding commit, change another file-level struct\nassignment to use designated initializers.\n\nRetain the \".name = NULL\" etc. in the case of the first element of\n\"unknown hash algorithm\", to make it explicit that we're intentionally\nnot setting those, it's not just that we forgot.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n object-file.c | 78 +++++++++++++++++++++++++--------------------------\n 1 file changed, 39 insertions(+), 39 deletions(-)\n\ndiff --git a/object-file.c b/object-file.c\nindex 8be57f48de7..03bd6a3baf3 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -167,49 +167,49 @@ static void git_hash_unknown_final_oid(struct object_id *oid, git_hash_ctx *ctx)\n \n const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = {\n \t{\n-\t\tNULL,\n-\t\t0x00000000,\n-\t\t0,\n-\t\t0,\n-\t\t0,\n-\t\tgit_hash_unknown_init,\n-\t\tgit_hash_unknown_clone,\n-\t\tgit_hash_unknown_update,\n-\t\tgit_hash_unknown_final,\n-\t\tgit_hash_unknown_final_oid,\n-\t\tNULL,\n-\t\tNULL,\n-\t\tNULL,\n+\t\t.name = NULL,\n+\t\t.format_id = 0x00000000,\n+\t\t.rawsz = 0,\n+\t\t.hexsz = 0,\n+\t\t.blksz = 0,\n+\t\t.init_fn = git_hash_unknown_init,\n+\t\t.clone_fn = git_hash_unknown_clone,\n+\t\t.update_fn = git_hash_unknown_update,\n+\t\t.final_fn = git_hash_unknown_final,\n+\t\t.final_oid_fn = git_hash_unknown_final_oid,\n+\t\t.empty_tree = NULL,\n+\t\t.empty_blob = NULL,\n+\t\t.null_oid = NULL,\n \t},\n \t{\n-\t\t\"sha1\",\n-\t\tGIT_SHA1_FORMAT_ID,\n-\t\tGIT_SHA1_RAWSZ,\n-\t\tGIT_SHA1_HEXSZ,\n-\t\tGIT_SHA1_BLKSZ,\n-\t\tgit_hash_sha1_init,\n-\t\tgit_hash_sha1_clone,\n-\t\tgit_hash_sha1_update,\n-\t\tgit_hash_sha1_final,\n-\t\tgit_hash_sha1_final_oid,\n-\t\t&empty_tree_oid,\n-\t\t&empty_blob_oid,\n-\t\t&null_oid_sha1,\n+\t\t.name = \"sha1\",\n+\t\t.format_id = GIT_SHA1_FORMAT_ID,\n+\t\t.rawsz = GIT_SHA1_RAWSZ,\n+\t\t.hexsz = GIT_SHA1_HEXSZ,\n+\t\t.blksz = GIT_SHA1_BLKSZ,\n+\t\t.init_fn = git_hash_sha1_init,\n+\t\t.clone_fn = git_hash_sha1_clone,\n+\t\t.update_fn = git_hash_sha1_update,\n+\t\t.final_fn = git_hash_sha1_final,\n+\t\t.final_oid_fn = git_hash_sha1_final_oid,\n+\t\t.empty_tree = &empty_tree_oid,\n+\t\t.empty_blob = &empty_blob_oid,\n+\t\t.null_oid = &null_oid_sha1,\n \t},\n \t{\n-\t\t\"sha256\",\n-\t\tGIT_SHA256_FORMAT_ID,\n-\t\tGIT_SHA256_RAWSZ,\n-\t\tGIT_SHA256_HEXSZ,\n-\t\tGIT_SHA256_BLKSZ,\n-\t\tgit_hash_sha256_init,\n-\t\tgit_hash_sha256_clone,\n-\t\tgit_hash_sha256_update,\n-\t\tgit_hash_sha256_final,\n-\t\tgit_hash_sha256_final_oid,\n-\t\t&empty_tree_oid_sha256,\n-\t\t&empty_blob_oid_sha256,\n-\t\t&null_oid_sha256,\n+\t\t.name = \"sha256\",\n+\t\t.format_id = GIT_SHA256_FORMAT_ID,\n+\t\t.rawsz = GIT_SHA256_RAWSZ,\n+\t\t.hexsz = GIT_SHA256_HEXSZ,\n+\t\t.blksz = GIT_SHA256_BLKSZ,\n+\t\t.init_fn = git_hash_sha256_init,\n+\t\t.clone_fn = git_hash_sha256_clone,\n+\t\t.update_fn = git_hash_sha256_update,\n+\t\t.final_fn = git_hash_sha256_final,\n+\t\t.final_oid_fn = git_hash_sha256_final_oid,\n+\t\t.empty_tree = &empty_tree_oid_sha256,\n+\t\t.empty_blob = &empty_blob_oid_sha256,\n+\t\t.null_oid = &null_oid_sha256,\n \t}\n };\n \n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449411","messageId":"patch-07.12-54e868d304c-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 07/12] archive-*.c: use designated initializers for \"struct archiver\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:02Z","receivedAt":"2022-02-24T09:33:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n archive-tar.c | 6 +++---\n archive-zip.c | 6 +++---\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 3c74db17468..042feb66d28 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -461,9 +461,9 @@ static int write_tar_filter_archive(const struct archiver *ar,\n }\n \n static struct archiver tar_archiver = {\n-\t\"tar\",\n-\twrite_tar_archive,\n-\tARCHIVER_REMOTE\n+\t.name = \"tar\",\n+\t.write_archive = write_tar_archive,\n+\t.flags = ARCHIVER_REMOTE,\n };\n \n void init_tar_archiver(void)\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 2961e01c754..90fe99eaaed 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -637,9 +637,9 @@ static int write_zip_archive(const struct archiver *ar,\n }\n \n static struct archiver zip_archiver = {\n-\t\"zip\",\n-\twrite_zip_archive,\n-\tARCHIVER_WANT_COMPRESSION_LEVELS|ARCHIVER_REMOTE\n+\t.name = \"zip\",\n+\t.write_archive = write_zip_archive,\n+\t.flags = ARCHIVER_WANT_COMPRESSION_LEVELS|ARCHIVER_REMOTE,\n };\n \n void init_zip_archiver(void)\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449412","messageId":"patch-08.12-9becff4bae7-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 08/12] userdiff.c: use designated initializers for \"struct userdiff_driver\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:03Z","receivedAt":"2022-02-24T09:33:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"struct userdiff_driver\" assignmentns to use designated\ninitializers, but let's keep the PATTERNS() and IPATTERN() convenience\nmacros to avoid churn, but have them defined in terms of designated\ninitializers.\n\nFor the \"driver_true\" and \"driver_false\" let's have the compiler\nimplicitly initialize most of the fields, but let's leave a redundant\n\".binary = 0\" for \"driver_true\" to make it obvious that it's the\nopposite of the the \".binary = 1\" for \"driver_false\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n userdiff.c | 36 ++++++++++++++++++++++--------------\n 1 file changed, 22 insertions(+), 14 deletions(-)\n\ndiff --git a/userdiff.c b/userdiff.c\nindex 8578cb0d12e..2d9eb99bf28 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -7,12 +7,24 @@ static struct userdiff_driver *drivers;\n static int ndrivers;\n static int drivers_alloc;\n \n-#define PATTERNS(name, pattern, word_regex)\t\t\t\\\n-\t{ name, NULL, -1, { pattern, REG_EXTENDED },\t\t\\\n-\t  word_regex \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\" }\n-#define IPATTERN(name, pattern, word_regex)\t\t\t\\\n-\t{ name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \\\n-\t  word_regex \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\" }\n+#define PATTERNS(lang, rx, wrx) { \\\n+\t.name = lang, \\\n+\t.binary = -1, \\\n+\t.funcname = { \\\n+\t\t.pattern = rx, \\\n+\t\t.cflags = REG_EXTENDED, \\\n+\t}, \\\n+\t.word_regex = wrx \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\", \\\n+}\n+#define IPATTERN(lang, rx, wrx) { \\\n+\t.name = lang, \\\n+\t.binary = -1, \\\n+\t.funcname = { \\\n+\t\t.pattern = rx, \\\n+\t\t.cflags = REG_EXTENDED | REG_ICASE, \\\n+\t}, \\\n+\t.word_regex = wrx \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\", \\\n+}\n \n /*\n  * Built-in drivers for various languages, sorted by their names\n@@ -275,17 +287,13 @@ PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n #undef IPATTERN\n \n static struct userdiff_driver driver_true = {\n-\t\"diff=true\",\n-\tNULL,\n-\t0,\n-\t{ NULL, 0 }\n+\t.name = \"diff=true\",\n+\t.binary = 0,\n };\n \n static struct userdiff_driver driver_false = {\n-\t\"!diff\",\n-\tNULL,\n-\t1,\n-\t{ NULL, 0 }\n+\t.name = \"!diff\",\n+\t.binary = 1,\n };\n \n struct find_by_namelen_data {\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449413","messageId":"patch-09.12-5ad9f535f18-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 09/12] convert.c: use designated initializers for \"struct stream_filter*\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:04Z","receivedAt":"2022-02-24T09:33:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"struct stream_filter_vtbl\" and \"struct stream_filter\"\nassignments in convert.c to use designated initializers.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n convert.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/convert.c b/convert.c\nindex df7186bd813..3d53a75a784 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1574,12 +1574,12 @@ static void null_free_fn(struct stream_filter *filter)\n }\n \n static struct stream_filter_vtbl null_vtbl = {\n-\tnull_filter_fn,\n-\tnull_free_fn,\n+\t.filter = null_filter_fn,\n+\t.free = null_free_fn,\n };\n \n static struct stream_filter null_filter_singleton = {\n-\t&null_vtbl,\n+\t.vtbl = &null_vtbl,\n };\n \n int is_null_stream_filter(struct stream_filter *filter)\n@@ -1683,8 +1683,8 @@ static void lf_to_crlf_free_fn(struct stream_filter *filter)\n }\n \n static struct stream_filter_vtbl lf_to_crlf_vtbl = {\n-\tlf_to_crlf_filter_fn,\n-\tlf_to_crlf_free_fn,\n+\t.filter = lf_to_crlf_filter_fn,\n+\t.free = lf_to_crlf_free_fn,\n };\n \n static struct stream_filter *lf_to_crlf_filter(void)\n@@ -1779,8 +1779,8 @@ static void cascade_free_fn(struct stream_filter *filter)\n }\n \n static struct stream_filter_vtbl cascade_vtbl = {\n-\tcascade_filter_fn,\n-\tcascade_free_fn,\n+\t.filter = cascade_filter_fn,\n+\t.free = cascade_free_fn,\n };\n \n static struct stream_filter *cascade_filter(struct stream_filter *one,\n@@ -1931,8 +1931,8 @@ static void ident_free_fn(struct stream_filter *filter)\n }\n \n static struct stream_filter_vtbl ident_vtbl = {\n-\tident_filter_fn,\n-\tident_free_fn,\n+\t.filter = ident_filter_fn,\n+\t.free = ident_free_fn,\n };\n \n static struct stream_filter *ident_filter(const struct object_id *oid)\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449414","messageId":"patch-10.12-8552c5701a2-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 10/12] refspec.c: use designated initializers for \"struct refspec_item\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:05Z","receivedAt":"2022-02-24T09:33:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"struct refspec_item\" at the top of refspec.c to use\ndesignated initializers. Let's keep the \"= 0\" assignments for\nself-documentation purposes, even though they're now redundant.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n refspec.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/refspec.c b/refspec.c\nindex e3d852c0bfe..63e3112104a 100644\n--- a/refspec.c\n+++ b/refspec.c\n@@ -4,13 +4,13 @@\n #include \"refspec.h\"\n \n static struct refspec_item s_tag_refspec = {\n-\t0,\n-\t1,\n-\t0,\n-\t0,\n-\t0,\n-\t\"refs/tags/*\",\n-\t\"refs/tags/*\"\n+\t.force = 0,\n+\t.pattern = 1,\n+\t.matching = 0,\n+\t.exact_sha1 = 0,\n+\t.negative = 0,\n+\t.src = \"refs/tags/*\",\n+\t.dst = \"refs/tags/*\",\n };\n \n /* See TAG_REFSPEC for the string version */\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449415","messageId":"patch-11.12-169d47fd06c-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 11/12] misc *.c: use designated initializers for struct assignments","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:06Z","receivedAt":"2022-02-24T09:33:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change a few miscellaneous non-designated initializer assignments to\nuse designated initializers.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n attr.c        | 2 +-\n notes-merge.c | 1 +\n object-file.c | 9 +++++----\n 3 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/attr.c b/attr.c\nindex 79adaa50ea1..9ad12578cce 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -80,7 +80,7 @@ static int attr_hash_entry_cmp(const void *unused_cmp_data,\n  * Access to this dictionary must be surrounded with a mutex.\n  */\n static struct attr_hashmap g_attr_hashmap = {\n-\tHASHMAP_INIT(attr_hash_entry_cmp, NULL)\n+\t.map = HASHMAP_INIT(attr_hash_entry_cmp, NULL),\n };\n \n /*\ndiff --git a/notes-merge.c b/notes-merge.c\nindex 01d596920ea..d749af1ab8b 100644\n--- a/notes-merge.c\n+++ b/notes-merge.c\n@@ -113,6 +113,7 @@ static struct notes_merge_pair *find_notes_merge_pair_pos(\n }\n \n static struct object_id uninitialized = {\n+\t.hash =\n \t\"\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\" \\\n \t\"\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\"\n };\ndiff --git a/object-file.c b/object-file.c\nindex 03bd6a3baf3..5074471b471 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -274,10 +274,11 @@ static struct cached_object {\n static int cached_object_nr, cached_object_alloc;\n \n static struct cached_object empty_tree = {\n-\t{ EMPTY_TREE_SHA1_BIN_LITERAL },\n-\tOBJ_TREE,\n-\t\"\",\n-\t0\n+\t.oid = {\n+\t\t.hash = EMPTY_TREE_SHA1_BIN_LITERAL,\n+\t},\n+\t.type = OBJ_TREE,\n+\t.buf = \"\",\n };\n \n static struct cached_object *find_cached_object(const struct object_id *oid)\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449416","messageId":"patch-12.12-d39622453d4-20220224T092805Z-avarab@gmail.com","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"[PATCH 12/12] misc *.c: use designated initializers for \"partial\" struct assignments","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T09:33:07Z","receivedAt":"2022-02-24T09:33:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change a few existing non-designated initializer assignments to use\n\"partial\" designated initializer assignments. I.e. we're now omitting\nthe \"NULL\" or \"0\" fields and letting the initializer take care of them\nfor us.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/fast-import.c | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 2b2e28bad79..2c244c68f7e 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -176,8 +176,9 @@ static int global_argc;\n static const char **global_argv;\n \n /* Memory pools */\n-static struct mem_pool fi_mem_pool =  {NULL, 2*1024*1024 -\n-\t\t\t\t       sizeof(struct mp_block), 0 };\n+static struct mem_pool fi_mem_pool = {\n+\t.block_alloc = 2*1024*1024 - sizeof(struct mp_block),\n+};\n \n /* Atom management */\n static unsigned int atom_table_sz = 4451;\n@@ -205,7 +206,9 @@ static int import_marks_file_done;\n static int relative_marks_paths;\n \n /* Our last blob */\n-static struct last_object last_blob = { STRBUF_INIT, 0, 0, 0 };\n+static struct last_object last_blob = {\n+\t.data = STRBUF_INIT,\n+ };\n \n /* Tree management */\n static unsigned int tree_entry_alloc = 1000;\n@@ -231,7 +234,10 @@ static struct tag *last_tag;\n static whenspec_type whenspec = WHENSPEC_RAW;\n static struct strbuf command_buf = STRBUF_INIT;\n static int unread_command_buf;\n-static struct recent_command cmd_hist = {&cmd_hist, &cmd_hist, NULL};\n+static struct recent_command cmd_hist = {\n+\t.prev = &cmd_hist,\n+\t.next = &cmd_hist,\n+};\n static struct recent_command *cmd_tail = &cmd_hist;\n static struct recent_command *rc_free;\n static unsigned int cmd_save = 100;\n-- \n2.35.1.1157.g524e2d5a0db\n\n"},{"id":"449497","messageId":"nycvar.QRO.7.76.6.2202242017590.11118@tvgsbejvaqbjf.bet","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"Re: [PATCH 00/12] c99: use more designated initializers","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-02-24T19:22:13Z","receivedAt":"2022-02-24T19:22:35Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ævar,\n\nOn Thu, 24 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n\n> A follow-up to 404c4a54624 (Merge branch 'ab/designated-initializers',\n> 2021-10-11) and a4b9fb6a5cf (Merge branch\n> 'ab/designated-initializers-more', 2021-10-18). These code readability\n> improvements are something we can allow ourselves now that we have a\n> hard dependency on C99.\n\nThis is probably a bit premature given that we still are treating the\nC99-isms as weather balloons. The idea was to keep things in an\neasily-revertable state for at least a couple of major versions.\n\nThe referenced changes are only in core Git as of v2.34.0, and we are not\neven half-way through the v2.36.0 cycle.\n\nDo not get me wrong, I have nothing against this living in `seen` for now,\nbut it should wait before it advances, probably at least until v2.36.0 if\nnot v2.37.0.\n\nCiao,\nJohannes\n"},{"id":"449499","messageId":"xmqqsfs8kpm4.fsf@gitster.g","threadId":"57469","inReplyTo":"nycvar.QRO.7.76.6.2202242017590.11118@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 00/12] c99: use more designated initializers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-02-24T19:53:55Z","receivedAt":"2022-02-24T19:54:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> This is probably a bit premature given that we still are treating the\n> C99-isms as weather balloons. The idea was to keep things in an\n> easily-revertable state for at least a couple of major versions.\n>\n> The referenced changes are only in core Git as of v2.34.0, and we are not\n> even half-way through the v2.36.0 cycle.\n\nThe proposed commit log messages need updating.  By refering to much\nnewer commits created by the same author, instead of the beginning\nof the official weather balloon experiments, it created an unnecessary\nconfusion.\n\nRead the CodingGuidelines document.  Everybody knows what it says by\nheart by now, right? ;-)\n\n   . since mid 2017 with cbc0f81d, we have been using designated\n     initializers for struct (e.g. \"struct t v = { .val = 'a' };\").\n\n   . since mid 2017 with 512f41cf, we have been using designated\n     initializers for array (e.g. \"int array[10] = { [5] = 2 }\").\n\nI do not think doing this in early 2022 is still premature.\n\nI hate to having to deal with such a tree-wide churn, though.  I'd\nrather see \"let's do this only on quiescent part of the tree a small\nbit at a time\" like on imap-send.c but not involving anything known\nto be actively touched, like ref backends.\n\nThanks.\n"},{"id":"449525","messageId":"220224.86y21z98zr.gmgdl@evledraar.gmail.com","threadId":"57469","inReplyTo":"xmqqsfs8kpm4.fsf@gitster.g","subject":"Re: [PATCH 00/12] c99: use more designated initializers","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-24T22:43:58Z","receivedAt":"2022-02-24T22:48:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Feb 24 2022, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n>> This is probably a bit premature given that we still are treating the\n>> C99-isms as weather balloons. The idea was to keep things in an\n>> easily-revertable state for at least a couple of major versions.\n>>\n>> The referenced changes are only in core Git as of v2.34.0, and we are not\n>> even half-way through the v2.36.0 cycle.\n>\n> The proposed commit log messages need updating.  By refering to much\n> newer commits created by the same author, instead of the beginning\n> of the official weather balloon experiments, it created an unnecessary\n> confusion.\n>\n> Read the CodingGuidelines document.  Everybody knows what it says by\n> heart by now, right? ;-)\n>\n>    . since mid 2017 with cbc0f81d, we have been using designated\n>      initializers for struct (e.g. \"struct t v = { .val = 'a' };\").\n>\n>    . since mid 2017 with 512f41cf, we have been using designated\n>      initializers for array (e.g. \"int array[10] = { [5] = 2 }\").\n>\n> I do not think doing this in early 2022 is still premature.\n\nIt's hard sometimes to anticipate what'll be the best reference. I\nfigured linking to similar recent tree-wide changes would make it easier\nfor reviewers to shortcut to \"oh, we had similar tree-wide changes\nrecently, so this is OK too\".\n\nAs opposed to referencing the initial forays into designated\ninitializers, which wouldn't provide the same overview of how tree-wide\nthis pattern already is at a glance.\n\nBut sure, I can mention that more prominently/discuss both.\n\n> I hate to having to deal with such a tree-wide churn, though.  I'd\n> rather see \"let's do this only on quiescent part of the tree a small\n> bit at a time\" like on imap-send.c but not involving anything known\n> to be actively touched, like ref backends.\n\nWhile these are tree-wide, I don't think you'll have any trouble with\nthem, including the ones touching the refs backend.\n\nWe're anticipating the final bits of the reftable integration, which\nwill add another declaration like the one in 2/12, but that won't\nconflict with these modifications of the existing assignment.\n\nOf course such a change might also want to use designated initializers\nto match, but that would have been a good idea anyway for new code\nregardless of whether this series got merged or not.\n"},{"id":"449536","messageId":"xmqq4k4nizhx.fsf@gitster.g","threadId":"57469","inReplyTo":"cover-00.12-00000000000-20220224T092805Z-avarab@gmail.com","subject":"Re: [PATCH 00/12] c99: use more designated initializers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-02-25T00:03:22Z","receivedAt":"2022-02-25T00:03:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Ævar Arnfjörð Bjarmason (12):\n>   imap-send.c: use designated initializers for \"struct imap_server_conf\"\n>   refs: use designated initializers for \"struct ref_storage_be\"\n>   refs: use designated initializers for \"struct ref_iterator_vtable\"\n>   trace2: use designated initializers for \"struct tr2_tgt\"\n>   trace2: use designated initializers for \"struct tr2_dst\"\n>   object-file: use designated initializers for \"struct git_hash_algo\"\n>   archive-*.c: use designated initializers for \"struct archiver\"\n>   userdiff.c: use designated initializers for \"struct userdiff_driver\"\n>   convert.c: use designated initializers for \"struct stream_filter*\"\n>   refspec.c: use designated initializers for \"struct refspec_item\"\n>   misc *.c: use designated initializers for struct assignments\n>   misc *.c: use designated initializers for \"partial\" struct assignments\n\nThese patches touch really dormant parts so let's apply them and\nimmediately merge to 'next' and down to 'master' by the end of\nmonth.  I really hate these non-urgent changes that might help\nfuture code to be in flight for too long.\n\n imap-send.c: use designated initializers for \"struct imap_server_conf\"\n trace2: use designated initializers for \"struct tr2_tgt\"\n trace2: use designated initializers for \"struct tr2_dst\"\n object-file: use designated initializers for \"struct git_hash_algo\"\n archive-*.c: use designated initializers for \"struct archiver\"\n userdiff.c: use designated initializers for \"struct userdiff_driver\"\n convert.c: use designated initializers for \"struct stream_filter*\"\n refspec.c: use designated initializers for \"struct refspec_item\"\n fast-import.c: use designated initializers for \"partial\" struct assignments\n"}]}