From: Timo Sirainen Date: Thu, 1 Apr 2021 18:42:02 +0000 (+0300) Subject: lib: Fix buffer_t aliasing problems with LTO X-Git-Tag: 2.3.15~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d9b4e14008b15b7a34b5c633b09b9670e866256;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix buffer_t aliasing problems with LTO This changes the buffer_t slightly, which requires adding extra braces when buffer_t contents are directly defined. This changes Dovecot to require C11 compatible compiler, because it uses anonymous union and struct. GNU99 extensions are also enough. --- diff --git a/src/anvil/anvil-settings.c b/src/anvil/anvil-settings.c index a6cac93a5d..a94823e02f 100644 --- a/src/anvil/anvil-settings.c +++ b/src/anvil/anvil-settings.c @@ -17,7 +17,7 @@ static struct file_listener_settings *anvil_unix_listeners[] = { &anvil_unix_listeners_array[1] }; static buffer_t anvil_unix_listeners_buf = { - anvil_unix_listeners, sizeof(anvil_unix_listeners), { NULL, } + { { anvil_unix_listeners, sizeof(anvil_unix_listeners) } } }; /* */ diff --git a/src/auth/auth-settings.c b/src/auth/auth-settings.c index d9db5db1f8..241e775b63 100644 --- a/src/auth/auth-settings.c +++ b/src/auth/auth-settings.c @@ -33,7 +33,7 @@ static struct file_listener_settings *auth_unix_listeners[] = { &auth_unix_listeners_array[5] }; static buffer_t auth_unix_listeners_buf = { - auth_unix_listeners, sizeof(auth_unix_listeners), { NULL, } + { { auth_unix_listeners, sizeof(auth_unix_listeners) } } }; /* */ @@ -73,7 +73,7 @@ static struct file_listener_settings *auth_worker_unix_listeners[] = { &auth_worker_unix_listeners_array[0] }; static buffer_t auth_worker_unix_listeners_buf = { - auth_worker_unix_listeners, sizeof(auth_worker_unix_listeners), { NULL, } + { { auth_worker_unix_listeners, sizeof(auth_worker_unix_listeners) } } }; /* */ diff --git a/src/config/config-settings.c b/src/config/config-settings.c index 2b1fe9e8b2..d19fe4ec6c 100644 --- a/src/config/config-settings.c +++ b/src/config/config-settings.c @@ -15,7 +15,7 @@ static struct file_listener_settings *config_unix_listeners[] = { &config_unix_listeners_array[0] }; static buffer_t config_unix_listeners_buf = { - config_unix_listeners, sizeof(config_unix_listeners), { NULL, } + { { config_unix_listeners, sizeof(config_unix_listeners) } } }; /* */ diff --git a/src/config/settings-get.pl b/src/config/settings-get.pl index e28d356980..eec117fd1f 100755 --- a/src/config/settings-get.pl +++ b/src/config/settings-get.pl @@ -140,7 +140,7 @@ for (my $i = 0; $i < scalar(@services); $i++) { } print "};\n"; print "buffer_t config_all_services_buf = {\n"; -print "\tconfig_all_services, sizeof(config_all_services), { NULL, }\n"; +print "\t{ { config_all_services, sizeof(config_all_services) } }\n"; print "};\n"; print "const struct setting_parser_info *all_default_roots[] = {\n"; diff --git a/src/dict/dict-settings.c b/src/dict/dict-settings.c index 01e9f15c3f..23c33f63df 100644 --- a/src/dict/dict-settings.c +++ b/src/dict/dict-settings.c @@ -14,7 +14,7 @@ static struct file_listener_settings *dict_unix_listeners[] = { &dict_unix_listeners_array[0] }; static buffer_t dict_unix_listeners_buf = { - dict_unix_listeners, sizeof(dict_unix_listeners), { NULL, } + { { dict_unix_listeners, sizeof(dict_unix_listeners) } } }; static struct file_listener_settings dict_async_unix_listeners_array[] = { @@ -24,7 +24,7 @@ static struct file_listener_settings *dict_async_unix_listeners[] = { &dict_async_unix_listeners_array[0] }; static buffer_t dict_async_unix_listeners_buf = { - dict_async_unix_listeners, sizeof(dict_async_unix_listeners), { NULL, } + { { dict_async_unix_listeners, sizeof(dict_async_unix_listeners) } } }; /* */ diff --git a/src/director/director-settings.c b/src/director/director-settings.c index a43eb6f13f..f74d68354d 100644 --- a/src/director/director-settings.c +++ b/src/director/director-settings.c @@ -18,8 +18,7 @@ static struct file_listener_settings *director_unix_listeners[] = { &director_unix_listeners_array[1] }; static buffer_t director_unix_listeners_buf = { - director_unix_listeners, - sizeof(director_unix_listeners), { NULL, } + { { director_unix_listeners, sizeof(director_unix_listeners) } } }; static struct file_listener_settings director_fifo_listeners_array[] = { { "login/proxy-notify", 0, "", "" } @@ -28,8 +27,7 @@ static struct file_listener_settings *director_fifo_listeners[] = { &director_fifo_listeners_array[0] }; static buffer_t director_fifo_listeners_buf = { - director_fifo_listeners, - sizeof(director_fifo_listeners), { NULL, } + { { director_fifo_listeners, sizeof(director_fifo_listeners) } } }; /* */ diff --git a/src/dns/dns-client-settings.c b/src/dns/dns-client-settings.c index 1fd36f0666..082e73523a 100644 --- a/src/dns/dns-client-settings.c +++ b/src/dns/dns-client-settings.c @@ -17,7 +17,7 @@ static struct file_listener_settings *dns_client_unix_listeners[] = { &dns_client_unix_listeners_array[1], }; static buffer_t dns_client_unix_listeners_buf = { - dns_client_unix_listeners, sizeof(dns_client_unix_listeners), { NULL, } + { { dns_client_unix_listeners, sizeof(dns_client_unix_listeners) } } }; /* */ diff --git a/src/doveadm/doveadm-settings.c b/src/doveadm/doveadm-settings.c index e39f006005..35cce5cdb0 100644 --- a/src/doveadm/doveadm-settings.c +++ b/src/doveadm/doveadm-settings.c @@ -21,7 +21,7 @@ static struct file_listener_settings *doveadm_unix_listeners[] = { &doveadm_unix_listeners_array[0] }; static buffer_t doveadm_unix_listeners_buf = { - doveadm_unix_listeners, sizeof(doveadm_unix_listeners), { NULL, } + { { doveadm_unix_listeners, sizeof(doveadm_unix_listeners) } } }; /* */ diff --git a/src/imap-hibernate/imap-hibernate-settings.c b/src/imap-hibernate/imap-hibernate-settings.c index 368364871b..d7618c0248 100644 --- a/src/imap-hibernate/imap-hibernate-settings.c +++ b/src/imap-hibernate/imap-hibernate-settings.c @@ -16,7 +16,7 @@ static struct file_listener_settings *imap_hibernate_unix_listeners[] = { &imap_hibernate_unix_listeners_array[0] }; static buffer_t imap_hibernate_unix_listeners_buf = { - imap_hibernate_unix_listeners, sizeof(imap_hibernate_unix_listeners), { NULL, } + { { imap_hibernate_unix_listeners, sizeof(imap_hibernate_unix_listeners) } } }; /* */ diff --git a/src/imap-login/imap-login-settings.c b/src/imap-login/imap-login-settings.c index f3715f2ba8..74ab65c7b8 100644 --- a/src/imap-login/imap-login-settings.c +++ b/src/imap-login/imap-login-settings.c @@ -19,7 +19,7 @@ static struct inet_listener_settings *imap_login_inet_listeners[] = { &imap_login_inet_listeners_array[1] }; static buffer_t imap_login_inet_listeners_buf = { - imap_login_inet_listeners, sizeof(imap_login_inet_listeners), { NULL, } + { { imap_login_inet_listeners, sizeof(imap_login_inet_listeners) } } }; /* */ diff --git a/src/imap-urlauth/imap-urlauth-login-settings.c b/src/imap-urlauth/imap-urlauth-login-settings.c index e3e700cbc9..3dc41f69c0 100644 --- a/src/imap-urlauth/imap-urlauth-login-settings.c +++ b/src/imap-urlauth/imap-urlauth-login-settings.c @@ -18,8 +18,8 @@ static struct file_listener_settings *imap_urlauth_login_unix_listeners[] = { &imap_urlauth_login_unix_listeners_array[0] }; static buffer_t imap_urlauth_login_unix_listeners_buf = { - imap_urlauth_login_unix_listeners, - sizeof(imap_urlauth_login_unix_listeners), { NULL, } + { { imap_urlauth_login_unix_listeners, + sizeof(imap_urlauth_login_unix_listeners) } } }; /* */ diff --git a/src/imap-urlauth/imap-urlauth-settings.c b/src/imap-urlauth/imap-urlauth-settings.c index 56fb267046..73c3220cce 100644 --- a/src/imap-urlauth/imap-urlauth-settings.c +++ b/src/imap-urlauth/imap-urlauth-settings.c @@ -17,7 +17,7 @@ static struct file_listener_settings *imap_urlauth_unix_listeners[] = { &imap_urlauth_unix_listeners_array[0] }; static buffer_t imap_urlauth_unix_listeners_buf = { - imap_urlauth_unix_listeners, sizeof(imap_urlauth_unix_listeners), { NULL, } + { { imap_urlauth_unix_listeners, sizeof(imap_urlauth_unix_listeners) } } }; /* */ diff --git a/src/imap-urlauth/imap-urlauth-worker-settings.c b/src/imap-urlauth/imap-urlauth-worker-settings.c index 7eef397f49..a459aed601 100644 --- a/src/imap-urlauth/imap-urlauth-worker-settings.c +++ b/src/imap-urlauth/imap-urlauth-worker-settings.c @@ -18,7 +18,8 @@ static struct file_listener_settings *imap_urlauth_worker_unix_listeners[] = { &imap_urlauth_worker_unix_listeners_array[0] }; static buffer_t imap_urlauth_worker_unix_listeners_buf = { - imap_urlauth_worker_unix_listeners, sizeof(imap_urlauth_worker_unix_listeners), { NULL, } + { { imap_urlauth_worker_unix_listeners, + sizeof(imap_urlauth_worker_unix_listeners) } } }; /* */ diff --git a/src/imap/imap-settings.c b/src/imap/imap-settings.c index 71dcb74591..2acf9dd8ed 100644 --- a/src/imap/imap-settings.c +++ b/src/imap/imap-settings.c @@ -25,7 +25,7 @@ static struct file_listener_settings *imap_unix_listeners[] = { &imap_unix_listeners_array[1] }; static buffer_t imap_unix_listeners_buf = { - imap_unix_listeners, sizeof(imap_unix_listeners), { NULL, } + { { imap_unix_listeners, sizeof(imap_unix_listeners) } } }; /* */ diff --git a/src/indexer/indexer-settings.c b/src/indexer/indexer-settings.c index 3363f72f01..837582972b 100644 --- a/src/indexer/indexer-settings.c +++ b/src/indexer/indexer-settings.c @@ -17,7 +17,7 @@ static struct file_listener_settings *indexer_unix_listeners[] = { &indexer_unix_listeners_array[0] }; static buffer_t indexer_unix_listeners_buf = { - indexer_unix_listeners, sizeof(indexer_unix_listeners), { NULL, } + { { indexer_unix_listeners, sizeof(indexer_unix_listeners) } } }; /* */ diff --git a/src/indexer/indexer-worker-settings.c b/src/indexer/indexer-worker-settings.c index 6d4caf3f46..8627954cba 100644 --- a/src/indexer/indexer-worker-settings.c +++ b/src/indexer/indexer-worker-settings.c @@ -15,7 +15,7 @@ static struct file_listener_settings *indexer_worker_unix_listeners[] = { &indexer_worker_unix_listeners_array[0] }; static buffer_t indexer_worker_unix_listeners_buf = { - indexer_worker_unix_listeners, sizeof(indexer_worker_unix_listeners), { NULL, } + { { indexer_worker_unix_listeners, sizeof(indexer_worker_unix_listeners) } } }; /* */ diff --git a/src/ipc/ipc-settings.c b/src/ipc/ipc-settings.c index ec191ac189..664565c620 100644 --- a/src/ipc/ipc-settings.c +++ b/src/ipc/ipc-settings.c @@ -17,7 +17,7 @@ static struct file_listener_settings *ipc_unix_listeners[] = { &ipc_unix_listeners_array[1] }; static buffer_t ipc_unix_listeners_buf = { - ipc_unix_listeners, sizeof(ipc_unix_listeners), { NULL, } + { { ipc_unix_listeners, sizeof(ipc_unix_listeners) } } }; /* */ diff --git a/src/lib/buffer.c b/src/lib/buffer.c index 195910fb68..71e6a5758e 100644 --- a/src/lib/buffer.c +++ b/src/lib/buffer.c @@ -6,18 +6,22 @@ #include "buffer.h" struct real_buffer { - /* public: */ - const void *r_buffer; - size_t used; - - /* private: */ - unsigned char *w_buffer; - size_t dirty, alloc, max_size; - - pool_t pool; - - bool alloced:1; - bool dynamic:1; + union { + struct buffer buf; + struct { + /* public: */ + const void *r_buffer; + size_t used; + /* private: */ + unsigned char *w_buffer; + size_t dirty, alloc, max_size; + + pool_t pool; + + bool alloced:1; + bool dynamic:1; + }; + }; }; typedef int buffer_check_sizes[COMPILE_ERROR_IF_TRUE(sizeof(struct real_buffer) > sizeof(buffer_t)) ?1:1]; diff --git a/src/lib/buffer.h b/src/lib/buffer.h index f28969d276..6472183ee2 100644 --- a/src/lib/buffer.h +++ b/src/lib/buffer.h @@ -2,9 +2,13 @@ #define BUFFER_H struct buffer { - const void *data; - const size_t used; - void *priv[6]; + union { + struct { + const void *data; + const size_t used; + }; + void *priv[8]; + }; }; /* WARNING: Be careful with functions that return pointers to data. diff --git a/src/lib/test-buffer.c b/src/lib/test-buffer.c index 0574cef1a4..50a2e92da5 100644 --- a/src/lib/test-buffer.c +++ b/src/lib/test-buffer.c @@ -235,52 +235,52 @@ static void test_buffer_truncate_bits(void) size_t bits; buffer_t output; } test_cases[] = { - { { "\xff\xff\xff", 3, {0} }, 0, { "", 0, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 1, { "\x01", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 2, { "\x03", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 3, { "\x07", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 4, { "\x0f", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 5, { "\x1f", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 6, { "\x3f", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 7, { "\x7f", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 8, { "\xff", 1, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 9, { "\x01\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 10, { "\x03\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 11, { "\x07\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 12, { "\x0f\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 13, { "\x1f\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 14, { "\x3f\xff", 2, {0} } }, - { { "\xff\xff\xff", 3, {0} }, 15, { "\x7f\xff", 2, {0} } }, - { { "0123456789", 10, {0} }, 16, { "01", 2, {0} } }, - { { "0123456789", 10, {0} }, 24, { "012", 3, {0} } }, - { { "0123456789", 10, {0} }, 32, { "0123", 4, {0} } }, - { { "0123456789", 10, {0} }, 40, { "01234", 5, {0} } }, - { { "0123456789", 10, {0} }, 48, { "012345", 6, {0} } }, - { { "0123456789", 10, {0} }, 56, { "0123456", 7, {0} } }, - { { "0123456789", 10, {0} }, 64, { "01234567", 8, {0} } }, - { { "0123456789", 10, {0} }, 72, { "012345678", 9, {0} } }, - { { "0123456789", 10, {0} }, 80, { "0123456789", 10, {0} } }, - - { { "\x58\x11\xed\x02\x4d\x87\x4a\xe2\x5c\xb2\xfa\x69\xf0\xa9\x46\x2e\x04\xca\x5d\x82", 20, {0} }, + { { { { "\xff\xff\xff", 3 } } }, 0, { { { "", 0 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 1, { { { "\x01", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 2, { { { "\x03", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 3, { { { "\x07", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 4, { { { "\x0f", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 5, { { { "\x1f", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 6, { { { "\x3f", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 7, { { { "\x7f", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 8, { { { "\xff", 1 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 9, { { { "\x01\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 10, { { { "\x03\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 11, { { { "\x07\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 12, { { { "\x0f\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 13, { { { "\x1f\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 14, { { { "\x3f\xff", 2 } } } }, + { { { { "\xff\xff\xff", 3 } } }, 15, { { { "\x7f\xff", 2 } } } }, + { { { { "0123456789", 10 } } }, 16, { { { "01", 2 } } } }, + { { { { "0123456789", 10 } } }, 24, { { { "012", 3 } } } }, + { { { { "0123456789", 10 } } }, 32, { { { "0123", 4 } } } }, + { { { { "0123456789", 10 } } }, 40, { { { "01234", 5 } } } }, + { { { { "0123456789", 10 } } }, 48, { { { "012345", 6 } } } }, + { { { { "0123456789", 10 } } }, 56, { { { "0123456", 7 } } } }, + { { { { "0123456789", 10 } } }, 64, { { { "01234567", 8 } } } }, + { { { { "0123456789", 10 } } }, 72, { { { "012345678", 9 } } } }, + { { { { "0123456789", 10 } } }, 80, { { { "0123456789", 10 } } } }, + + { { { { "\x58\x11\xed\x02\x4d\x87\x4a\xe2\x5c\xb2\xfa\x69\xf0\xa9\x46\x2e\x04\xca\x5d\x82", 20 } } }, 13, - { "\x0b\x02", 2, {0} } + { { { "\x0b\x02", 2 } } } }, /* special test cases for auth policy */ - { { "\x34\x40\xc8\xc9\x3a\xb6\xe7\xc4\x3f\xc1\xc3\x4d\xd5\x56\xa3\xea\xfb\x5a\x33\x57\xac\x11\x39\x2c\x71\xcb\xee\xbb\xc8\x66\x2f\x64", 32, {0} }, + { { { { "\x34\x40\xc8\xc9\x3a\xb6\xe7\xc4\x3f\xc1\xc3\x4d\xd5\x56\xa3\xea\xfb\x5a\x33\x57\xac\x11\x39\x2c\x71\xcb\xee\xbb\xc8\x66\x2f\x64", 32 } } }, 12, - { "\x03\x44", 2, {0} } + { { { "\x03\x44", 2 } } } }, - { { "\x49\xe5\x8a\x88\x76\xd3\x25\x68\xc9\x89\x4a\xe0\x64\xe4\x04\xf4\xf9\x13\xec\x88\x97\x47\x30\x7f\x3f\xcd\x8f\x74\x4f\x40\xd1\x25", 32, {0} }, + { { { { "\x49\xe5\x8a\x88\x76\xd3\x25\x68\xc9\x89\x4a\xe0\x64\xe4\x04\xf4\xf9\x13\xec\x88\x97\x47\x30\x7f\x3f\xcd\x8f\x74\x4f\x40\xd1\x25", 32 } } }, 12, - { "\x04\x9e", 2, {0} } + { { { "\x04\x9e", 2 } } } }, - { { "\x08\x3c\xdc\x14\x61\x80\x1c\xe8\x43\x81\x98\xfa\xc0\x64\x04\x7a\xa2\x73\x25\x6e\xe6\x4b\x85\x42\xd0\xe2\x78\xd7\x91\xb4\x89\x3f", 32, {0} }, + { { { { "\x08\x3c\xdc\x14\x61\x80\x1c\xe8\x43\x81\x98\xfa\xc0\x64\x04\x7a\xa2\x73\x25\x6e\xe6\x4b\x85\x42\xd0\xe2\x78\xd7\x91\xb4\x89\x3f", 32 } } }, 12, - { "\x00\x83", 2, {0} } + { { { "\x00\x83", 2 } } } }, }; diff --git a/src/lmtp/lmtp-settings.c b/src/lmtp/lmtp-settings.c index d5322ea3e5..5cec2bea5a 100644 --- a/src/lmtp/lmtp-settings.c +++ b/src/lmtp/lmtp-settings.c @@ -24,7 +24,7 @@ static struct file_listener_settings *lmtp_unix_listeners[] = { &lmtp_unix_listeners_array[0] }; static buffer_t lmtp_unix_listeners_buf = { - lmtp_unix_listeners, sizeof(lmtp_unix_listeners), { NULL, } + { { lmtp_unix_listeners, sizeof(lmtp_unix_listeners) } } }; /* */ diff --git a/src/log/log-settings.c b/src/log/log-settings.c index c4fc978c04..7c55544f45 100644 --- a/src/log/log-settings.c +++ b/src/log/log-settings.c @@ -15,8 +15,7 @@ static struct file_listener_settings *log_unix_listeners[] = { &log_unix_listeners_array[0] }; static buffer_t log_unix_listeners_buf = { - log_unix_listeners, - sizeof(log_unix_listeners), { NULL, } + { { log_unix_listeners, sizeof(log_unix_listeners) } } }; /* */ diff --git a/src/old-stats/stats-settings.c b/src/old-stats/stats-settings.c index 72c61f6feb..3aa65af0c5 100644 --- a/src/old-stats/stats-settings.c +++ b/src/old-stats/stats-settings.c @@ -14,7 +14,7 @@ static struct file_listener_settings *old_stats_unix_listeners[] = { &old_stats_unix_listeners_array[0] }; static buffer_t old_stats_unix_listeners_buf = { - old_stats_unix_listeners, sizeof(old_stats_unix_listeners), { NULL, } + { { old_stats_unix_listeners, sizeof(old_stats_unix_listeners) } } }; static struct file_listener_settings old_stats_fifo_listeners_array[] = { { "old-stats-mail", 0600, "", "" }, @@ -25,8 +25,7 @@ static struct file_listener_settings *old_stats_fifo_listeners[] = { &old_stats_fifo_listeners_array[1] }; static buffer_t old_stats_fifo_listeners_buf = { - old_stats_fifo_listeners, - sizeof(old_stats_fifo_listeners), { NULL, } + { { old_stats_fifo_listeners, sizeof(old_stats_fifo_listeners) } } }; /* */ diff --git a/src/plugins/fts-lucene/Snowball.cc b/src/plugins/fts-lucene/Snowball.cc index ca7f06bbc1..43b54e36e9 100644 --- a/src/plugins/fts-lucene/Snowball.cc +++ b/src/plugins/fts-lucene/Snowball.cc @@ -116,7 +116,7 @@ CL_NS_DEF2(analysis,snowball) unsigned char utf8text[LUCENE_MAX_WORD_LEN*5+1]; unsigned int len = I_MIN(LUCENE_MAX_WORD_LEN, token->termLength()); - buffer_t buf = { 0, 0, { 0, 0, 0, 0, 0 } }; + buffer_t buf = { { 0, 0 } }; i_assert(sizeof(wchar_t) == sizeof(unichar_t)); buffer_create_from_data(&buf, utf8text, sizeof(utf8text)); uni_ucs4_to_utf8((const unichar_t *)token->termBuffer(), len, &buf); diff --git a/src/plugins/fts-lucene/lucene-wrapper.cc b/src/plugins/fts-lucene/lucene-wrapper.cc index 4e12a4402e..744669386b 100644 --- a/src/plugins/fts-lucene/lucene-wrapper.cc +++ b/src/plugins/fts-lucene/lucene-wrapper.cc @@ -215,7 +215,7 @@ void lucene_utf8_n_to_tchar(const unsigned char *src, size_t srcsize, wchar_t *dest, size_t destsize) { ARRAY_TYPE(unichars) dest_arr; - buffer_t buf = { 0, 0, { 0, 0, 0, 0, 0 } }; + buffer_t buf = { { 0, 0 } }; i_assert(sizeof(wchar_t) == sizeof(unichar_t)); @@ -656,7 +656,7 @@ int lucene_index_build_deinit(struct lucene_index *index) static int wcharguid_to_guid(guid_128_t dest, const wchar_t *src) { - buffer_t buf = { 0, 0, { 0, 0, 0, 0, 0 } }; + buffer_t buf = { { 0, 0 } }; char src_chars[GUID_128_SIZE*2 + 1]; unsigned int i; @@ -926,7 +926,7 @@ int lucene_index_rescan(struct lucene_index *index) static void guid128_to_wguid(const guid_128_t guid, wchar_t wguid_hex[MAILBOX_GUID_HEX_LENGTH + 1]) { - buffer_t buf = { 0, 0, { 0, 0, 0, 0, 0 } }; + buffer_t buf = { { 0, 0 } }; unsigned char guid_hex[MAILBOX_GUID_HEX_LENGTH]; unsigned int i; diff --git a/src/pop3-login/pop3-login-settings.c b/src/pop3-login/pop3-login-settings.c index 7852ec605d..747e51e508 100644 --- a/src/pop3-login/pop3-login-settings.c +++ b/src/pop3-login/pop3-login-settings.c @@ -19,7 +19,7 @@ static struct inet_listener_settings *pop3_login_inet_listeners[] = { &pop3_login_inet_listeners_array[1] }; static buffer_t pop3_login_inet_listeners_buf = { - pop3_login_inet_listeners, sizeof(pop3_login_inet_listeners), { NULL, } + { { pop3_login_inet_listeners, sizeof(pop3_login_inet_listeners) } } }; /* */ diff --git a/src/pop3/pop3-settings.c b/src/pop3/pop3-settings.c index efc6bfd6a8..0606dc8059 100644 --- a/src/pop3/pop3-settings.c +++ b/src/pop3/pop3-settings.c @@ -21,7 +21,7 @@ static struct file_listener_settings *pop3_unix_listeners[] = { &pop3_unix_listeners_array[0] }; static buffer_t pop3_unix_listeners_buf = { - pop3_unix_listeners, sizeof(pop3_unix_listeners), { NULL, } + { { pop3_unix_listeners, sizeof(pop3_unix_listeners) } } }; /* */ diff --git a/src/replication/aggregator/aggregator-settings.c b/src/replication/aggregator/aggregator-settings.c index a0c1be3028..98597bde15 100644 --- a/src/replication/aggregator/aggregator-settings.c +++ b/src/replication/aggregator/aggregator-settings.c @@ -14,7 +14,7 @@ static struct file_listener_settings *aggregator_unix_listeners[] = { &aggregator_unix_listeners_array[0] }; static buffer_t aggregator_unix_listeners_buf = { - aggregator_unix_listeners, sizeof(aggregator_unix_listeners), { NULL, } + { { aggregator_unix_listeners, sizeof(aggregator_unix_listeners) } } }; static struct file_listener_settings aggregator_fifo_listeners_array[] = { @@ -24,7 +24,7 @@ static struct file_listener_settings *aggregator_fifo_listeners[] = { &aggregator_fifo_listeners_array[0] }; static buffer_t aggregator_fifo_listeners_buf = { - aggregator_fifo_listeners, sizeof(aggregator_fifo_listeners), { NULL, } + { { aggregator_fifo_listeners, sizeof(aggregator_fifo_listeners) } } }; /* */ diff --git a/src/replication/replicator/replicator-settings.c b/src/replication/replicator/replicator-settings.c index 4696f44793..3965100d6b 100644 --- a/src/replication/replicator/replicator-settings.c +++ b/src/replication/replicator/replicator-settings.c @@ -16,7 +16,7 @@ static struct file_listener_settings *replicator_unix_listeners[] = { &replicator_unix_listeners_array[1] }; static buffer_t replicator_unix_listeners_buf = { - replicator_unix_listeners, sizeof(replicator_unix_listeners), { NULL, } + { { replicator_unix_listeners, sizeof(replicator_unix_listeners) } } }; /* */ diff --git a/src/stats/stats-settings.c b/src/stats/stats-settings.c index 50020df678..c7e631eeb1 100644 --- a/src/stats/stats-settings.c +++ b/src/stats/stats-settings.c @@ -26,7 +26,7 @@ static struct file_listener_settings *stats_unix_listeners[] = { &stats_unix_listeners_array[1], }; static buffer_t stats_unix_listeners_buf = { - stats_unix_listeners, sizeof(stats_unix_listeners), { NULL, } + { { stats_unix_listeners, sizeof(stats_unix_listeners) } } }; /* */ diff --git a/src/submission-login/submission-login-settings.c b/src/submission-login/submission-login-settings.c index c4a7e8be12..4a6f211820 100644 --- a/src/submission-login/submission-login-settings.c +++ b/src/submission-login/submission-login-settings.c @@ -22,7 +22,8 @@ static struct inet_listener_settings *submission_login_inet_listeners[] = { &submission_login_inet_listeners_array[0] }; static buffer_t submission_login_inet_listeners_buf = { - submission_login_inet_listeners, sizeof(submission_login_inet_listeners), { 0, } + { { submission_login_inet_listeners, + sizeof(submission_login_inet_listeners) } } }; /* */ diff --git a/src/submission/submission-settings.c b/src/submission/submission-settings.c index 034ec619fd..c4dd3dbbff 100644 --- a/src/submission/submission-settings.c +++ b/src/submission/submission-settings.c @@ -22,7 +22,7 @@ static struct file_listener_settings *submission_unix_listeners[] = { &submission_unix_listeners_array[0] }; static buffer_t submission_unix_listeners_buf = { - submission_unix_listeners, sizeof(submission_unix_listeners), { 0, } + { { submission_unix_listeners, sizeof(submission_unix_listeners) } } }; /* */