]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replaced all instances of memset(p, 0, sizeof(*p)) with the new i_zero()...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 18 Dec 2016 12:22:15 +0000 (13:22 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 24 Dec 2016 00:46:31 +0000 (01:46 +0100)
Used the following script:

C_FILES=`git ls-files *.c`
H_FILES=`git ls-files *.h`
for F in "$C_FILES $H_FILES"; do
        echo "$F"
  perl -p -i -e 's/safe_memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero_safe(&$1)/g' $F
  perl -p -i -e 's/safe_memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero_safe($1)/g' $F
  perl -p -i -e 's/memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero(&$1)/g' $F
  perl -p -i -e 's/memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero($1)/g' $F
done

357 files changed:
src/auth/auth-request-var-expand.c
src/auth/auth-request.c
src/auth/auth-settings.c
src/auth/db-dict.c
src/auth/db-ldap.c
src/auth/main.c
src/auth/passdb-pam.c
src/config/config-connection.c
src/config/config-filter.c
src/config/config-parser.c
src/config/doveconf.c
src/config/old-set-parser.c
src/dict/dict-connection.c
src/dict/main.c
src/director/login-connection.c
src/doveadm/client-connection-http.c
src/doveadm/client-connection.c
src/doveadm/doveadm-auth-server.c
src/doveadm/doveadm-auth.c
src/doveadm/doveadm-cmd.c
src/doveadm/doveadm-dict.c
src/doveadm/doveadm-dsync.c
src/doveadm/doveadm-fs.c
src/doveadm/doveadm-kick.c
src/doveadm/doveadm-log.c
src/doveadm/doveadm-mail-batch.c
src/doveadm/doveadm-mail-fetch.c
src/doveadm/doveadm-mail-import.c
src/doveadm/doveadm-mail-mailbox-status.c
src/doveadm/doveadm-mail-server.c
src/doveadm/doveadm-mail.c
src/doveadm/doveadm-penalty.c
src/doveadm/doveadm-print-formatted.c
src/doveadm/doveadm-print-json.c
src/doveadm/doveadm-print.c
src/doveadm/doveadm-pw.c
src/doveadm/doveadm-stats.c
src/doveadm/doveadm-util.c
src/doveadm/doveadm-who.c
src/doveadm/doveadm-zlib.c
src/doveadm/doveadm.c
src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c
src/doveadm/dsync/dsync-brain-mailbox.c
src/doveadm/dsync/dsync-brain-mails.c
src/doveadm/dsync/dsync-brain.c
src/doveadm/dsync/dsync-ibc-stream.c
src/doveadm/dsync/dsync-mail.c
src/doveadm/dsync/dsync-mailbox-export.c
src/doveadm/dsync/dsync-mailbox-import.c
src/doveadm/dsync/dsync-mailbox-tree-fill.c
src/doveadm/dsync/dsync-transaction-log-scan.c
src/doveadm/main.c
src/doveadm/server-connection.c
src/imap-hibernate/imap-hibernate-client.c
src/imap-login/client-authenticate.c
src/imap-login/imap-proxy.c
src/imap-urlauth/imap-urlauth-worker.c
src/imap-urlauth/imap-urlauth.c
src/imap/cmd-fetch.c
src/imap/cmd-notify.c
src/imap/cmd-select.c
src/imap/cmd-setmetadata.c
src/imap/cmd-store.c
src/imap/imap-client.c
src/imap/imap-commands-util.c
src/imap/imap-commands.c
src/imap/imap-fetch.c
src/imap/imap-master-client.c
src/imap/imap-notify.c
src/imap/imap-state.c
src/imap/imap-status.c
src/imap/main.c
src/indexer/indexer-worker.c
src/indexer/master-connection.c
src/lda/main.c
src/lib-auth/auth-master.c
src/lib-auth/auth-server-connection.c
src/lib-dcrypt/dcrypt-gnutls.c
src/lib-dcrypt/dcrypt-openssl.c
src/lib-dcrypt/dcrypt.c
src/lib-dcrypt/test-crypto.c
src/lib-dict-extra/dict-fs.c
src/lib-dict/dict-cdb.c
src/lib-dict/dict-client.c
src/lib-dict/dict-db.c
src/lib-dict/dict-file.c
src/lib-dict/dict-memcached-ascii.c
src/lib-dict/dict-memcached.c
src/lib-dict/dict-sql-settings.c
src/lib-dict/dict-sql.c
src/lib-dict/dict.c
src/lib-dict/test-dict-client.c
src/lib-dns/dns-lookup.c
src/lib-fs/fs-api.c
src/lib-fs/fs-dict.c
src/lib-fs/fs-posix.c
src/lib-fs/fs-test-async.c
src/lib-fs/fs-test.c
src/lib-fts/fts-icu.c
src/lib-http/http-auth.c
src/lib-http/http-client-connection.c
src/lib-http/http-client-host.c
src/lib-http/http-client-request.c
src/lib-http/http-date.c
src/lib-http/http-message-parser.c
src/lib-http/http-parser.c
src/lib-http/http-request-parser.c
src/lib-http/http-response-parser.c
src/lib-http/http-response.c
src/lib-http/http-server-connection.c
src/lib-http/http-server-response.c
src/lib-http/http-url.c
src/lib-http/test-http-auth.c
src/lib-http/test-http-client-errors.c
src/lib-http/test-http-client.c
src/lib-http/test-http-payload.c
src/lib-http/test-http-response-parser.c
src/lib-http/test-http-server-errors.c
src/lib-http/test-http-server.c
src/lib-imap-client/imapc-client.c
src/lib-imap-client/imapc-connection.c
src/lib-imap-storage/imap-metadata.c
src/lib-imap-storage/imap-msgpart-url.c
src/lib-imap-storage/imap-msgpart.c
src/lib-imap-urlauth/imap-urlauth-backend.c
src/lib-imap-urlauth/imap-urlauth-connection.c
src/lib-imap-urlauth/imap-urlauth-fetch.c
src/lib-imap/imap-bodystructure.c
src/lib-imap/imap-date.c
src/lib-imap/imap-id.c
src/lib-imap/imap-url.c
src/lib-index/mail-cache-compress.c
src/lib-index/mail-cache-fields.c
src/lib-index/mail-cache-lookup.c
src/lib-index/mail-cache-transaction.c
src/lib-index/mail-index-alloc-cache.c
src/lib-index/mail-index-fsck.c
src/lib-index/mail-index-map-read.c
src/lib-index/mail-index-map.c
src/lib-index/mail-index-modseq.c
src/lib-index/mail-index-strmap.c
src/lib-index/mail-index-sync-ext.c
src/lib-index/mail-index-sync-keywords.c
src/lib-index/mail-index-sync-update.c
src/lib-index/mail-index-sync.c
src/lib-index/mail-index-transaction-export.c
src/lib-index/mail-index-transaction-update.c
src/lib-index/mail-index-transaction-view.c
src/lib-index/mail-index-transaction.c
src/lib-index/mail-index-view-sync.c
src/lib-index/mail-index-view.c
src/lib-index/mail-index.c
src/lib-index/mail-transaction-log-append.c
src/lib-index/mail-transaction-log-file.c
src/lib-index/mail-transaction-log.c
src/lib-index/test-mail-index-map.c
src/lib-index/test-mail-index-sync-ext.c
src/lib-index/test-mail-index-transaction-finish.c
src/lib-index/test-mail-transaction-log-view.c
src/lib-lda/duplicate.c
src/lib-lda/lmtp-client.c
src/lib-lda/mail-deliver.c
src/lib-lda/smtp-client.c
src/lib-ldap/ldap-compare.c
src/lib-ldap/ldap-connection.c
src/lib-mail/istream-attachment-extractor.c
src/lib-mail/mbox-from.c
src/lib-mail/message-address.c
src/lib-mail/message-date.c
src/lib-mail/message-header-decode.c
src/lib-mail/message-header-parser.c
src/lib-mail/message-parser.c
src/lib-mail/message-part-serialize.c
src/lib-mail/message-search.c
src/lib-mail/message-snippet.c
src/lib-mail/rfc2231-parser.c
src/lib-mail/rfc822-parser.c
src/lib-mail/test-istream-attachment.c
src/lib-mail/test-message-decoder.c
src/lib-mail/test-message-header-hash.c
src/lib-mail/test-message-search.c
src/lib-master/master-auth.c
src/lib-master/master-login.c
src/lib-master/master-service-settings.c
src/lib-master/master-service-ssl.c
src/lib-master/master-service.c
src/lib-master/test-master-service-settings-cache.c
src/lib-ntlm/ntlm-message.c
src/lib-settings/settings-parser.c
src/lib-settings/settings.c
src/lib-sql/driver-cassandra.c
src/lib-sql/driver-mysql.c
src/lib-sql/driver-pgsql.c
src/lib-sql/driver-sqlite.c
src/lib-ssl-iostream/iostream-ssl.c
src/lib-storage/index/dbox-common/dbox-save.c
src/lib-storage/index/dbox-multi/mdbox-deleted-storage.c
src/lib-storage/index/dbox-multi/mdbox-map.c
src/lib-storage/index/dbox-multi/mdbox-save.c
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
src/lib-storage/index/dbox-multi/mdbox-storage.c
src/lib-storage/index/dbox-single/sdbox-storage.c
src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c
src/lib-storage/index/imapc/imapc-list.c
src/lib-storage/index/imapc/imapc-storage.c
src/lib-storage/index/index-attachment.c
src/lib-storage/index/index-attribute.c
src/lib-storage/index/index-mail-binary.c
src/lib-storage/index/index-mail-headers.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-mailbox-size.c
src/lib-storage/index/index-pop3-uidl.c
src/lib-storage/index/index-rebuild.c
src/lib-storage/index/index-search-result.c
src/lib-storage/index/index-search.c
src/lib-storage/index/index-sort-string.c
src/lib-storage/index/index-sort.c
src/lib-storage/index/index-storage.c
src/lib-storage/index/index-sync-changes.c
src/lib-storage/index/index-sync.c
src/lib-storage/index/index-thread-finish.c
src/lib-storage/index/index-thread.c
src/lib-storage/index/index-transaction.c
src/lib-storage/index/maildir/maildir-copy.c
src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/maildir/maildir-sync-index.c
src/lib-storage/index/maildir/maildir-uidlist.c
src/lib-storage/index/mbox/mbox-lock.c
src/lib-storage/index/mbox/mbox-save.c
src/lib-storage/index/mbox/mbox-sync-list-index.c
src/lib-storage/index/mbox/mbox-sync-parse.c
src/lib-storage/index/mbox/mbox-sync-rewrite.c
src/lib-storage/index/mbox/mbox-sync.c
src/lib-storage/index/pop3c/pop3c-client.c
src/lib-storage/index/pop3c/pop3c-storage.c
src/lib-storage/index/pop3c/pop3c-sync.c
src/lib-storage/list/mailbox-list-index-backend.c
src/lib-storage/list/mailbox-list-index-notify.c
src/lib-storage/list/mailbox-list-index-status.c
src/lib-storage/list/mailbox-list-index-sync.c
src/lib-storage/list/mailbox-list-iter.c
src/lib-storage/list/mailbox-list-notify-tree.c
src/lib-storage/list/mailbox-list-subscriptions.c
src/lib-storage/list/subscription-file.c
src/lib-storage/mail-search-args-simplify.c
src/lib-storage/mail-search-build.c
src/lib-storage/mail-storage-hooks.c
src/lib-storage/mail-storage-service.c
src/lib-storage/mail-storage.c
src/lib-storage/mail-user.c
src/lib-storage/mailbox-attribute.c
src/lib-storage/mailbox-list.c
src/lib/buffer.c
src/lib/connection.c
src/lib/failures.c
src/lib/fd-close-on-exec.c
src/lib/file-dotlock.c
src/lib/file-lock.c
src/lib/file-set-size.c
src/lib/ioloop-epoll.c
src/lib/ioloop.c
src/lib/iso8601-date.c
src/lib/istream-sized.c
src/lib/istream.c
src/lib/lib-signals.c
src/lib/md4.c
src/lib/md5.c
src/lib/mempool-alloconly.c
src/lib/mountpoint.c
src/lib/net.c
src/lib/ostream.c
src/lib/restrict-access.c
src/lib/sendfile-util.c
src/lib/seq-range-array.c
src/lib/sha3.c
src/lib/test-ioloop.c
src/lib/test-utc-mktime.c
src/lib/timing.c
src/lib/uri-util.c
src/lib/var-expand.c
src/lmtp/client.c
src/lmtp/commands.c
src/lmtp/lmtp-proxy.c
src/lmtp/main.c
src/log/log-connection.c
src/login-common/client-common-auth.c
src/login-common/login-proxy-state.c
src/login-common/login-settings.c
src/login-common/main.c
src/login-common/sasl-server.c
src/login-common/ssl-proxy-openssl.c
src/master/main.c
src/master/sd-daemon.c
src/master/service-listen.c
src/master/service-log.c
src/master/service-monitor.c
src/plugins/acl/acl-api.c
src/plugins/acl/acl-attributes.c
src/plugins/acl/acl-backend-vfile-update.c
src/plugins/acl/acl-backend-vfile.c
src/plugins/acl/acl-global-file.c
src/plugins/acl/acl-lookup-dict.c
src/plugins/acl/acl-mailbox-list.c
src/plugins/acl/acl-mailbox.c
src/plugins/acl/doveadm-acl.c
src/plugins/dict-ldap/dict-ldap-settings.c
src/plugins/dict-ldap/dict-ldap.c
src/plugins/expire/doveadm-expire.c
src/plugins/expire/expire-plugin.c
src/plugins/fts-lucene/doveadm-fts-lucene.c
src/plugins/fts-solr/fts-backend-solr.c
src/plugins/fts-solr/solr-connection.c
src/plugins/fts-squat/squat-trie.c
src/plugins/fts-squat/squat-uidlist.c
src/plugins/fts/doveadm-fts.c
src/plugins/fts/fts-api.c
src/plugins/fts/fts-build-mail.c
src/plugins/fts/fts-parser-tika.c
src/plugins/fts/fts-search.c
src/plugins/fts/xml2text.c
src/plugins/imap-acl/imap-acl-plugin.c
src/plugins/last-login/last-login-plugin.c
src/plugins/mail-crypt/doveadm-mail-crypt.c
src/plugins/mail-crypt/mail-crypt-acl-plugin.c
src/plugins/mail-crypt/mail-crypt-global-key.c
src/plugins/mail-crypt/mail-crypt-plugin.c
src/plugins/mail-crypt/mail-crypt-pluginenv.c
src/plugins/mail-crypt/test-mail-global-key.c
src/plugins/mail-crypt/test-mail-key.c
src/plugins/pop3-migration/pop3-migration-plugin.c
src/plugins/push-notification/push-notification-driver-ox.c
src/plugins/push-notification/push-notification-event-flagsclear.c
src/plugins/push-notification/push-notification-event-flagsset.c
src/plugins/push-notification/push-notification-event-messageappend.c
src/plugins/push-notification/push-notification-event-messagenew.c
src/plugins/quota-clone/quota-clone-plugin.c
src/plugins/quota/doveadm-quota.c
src/plugins/quota/quota-count.c
src/plugins/quota/quota-dict.c
src/plugins/quota/quota-status.c
src/plugins/quota/quota-util.c
src/plugins/quota/quota.c
src/plugins/quota/test-quota-util.c
src/plugins/stats/mail-stats-fill.c
src/plugins/virtual/virtual-config.c
src/plugins/virtual/virtual-mail.c
src/plugins/virtual/virtual-search.c
src/plugins/virtual/virtual-sync.c
src/plugins/zlib/zlib-plugin.c
src/pop3-login/pop3-proxy.c
src/pop3/main.c
src/replication/replicator/replicator-queue-auth.c
src/replication/replicator/replicator-queue.c
src/stats/client-export.c
src/stats/client-reset.c
src/stats/main.c
src/util/script-login.c

index 43ecd1ca2e7e7d1a3eaef5510133f691152077b9..e4a2889ddb5b032b35ac445841a013b9db7937d5 100644 (file)
@@ -252,7 +252,7 @@ int auth_request_var_expand_with_table(string_t *dest, const char *str,
 {
        struct auth_request_var_expand_ctx ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.auth_request = auth_request;
        ctx.escape_func = escape_func == NULL ? escape_none : escape_func;
        return var_expand_with_funcs(dest, str, table,
index e9e20d54d0456ecbfb7d45d8f635a3d5c4d8c6a3..8b7d69ecbfe2e711d6fad18617c514e59870e8a7 100644 (file)
@@ -2177,7 +2177,7 @@ static int auth_request_proxy_host_lookup(struct auth_request *request,
        unsigned int secs;
 
        /* need to do dns lookup for the host */
-       memset(&dns_set, 0, sizeof(dns_set));
+       i_zero(&dns_set);
        dns_set.dns_client_socket_path = AUTH_DNS_SOCKET_PATH;
        dns_set.timeout_msecs = AUTH_DNS_DEFAULT_TIMEOUT_MSECS;
        value = auth_fields_find(request->extra_fields, "proxy_timeout");
index ea987cb6fde62593a62c350e3f998da265f8a887..7c1f229f51214a3b0ca9d568fd67c6baa854ef64 100644 (file)
@@ -511,7 +511,7 @@ auth_settings_read(const char *service, pool_t pool,
        const char *error;
        void **sets;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "auth";
        input.service = service;
index 4559e556e78fbffb7886c43434fa4b4abda6a9da..3a9f03d70bdfa1520e505847363fcba537f6608c 100644 (file)
@@ -298,7 +298,7 @@ struct dict_connection *db_dict_init(const char *config_path)
        p_array_init(&conn->set.parsed_passdb_objects, pool, 2);
        p_array_init(&conn->set.parsed_userdb_objects, pool, 2);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.conn = conn;
        if (!settings_read(config_path, NULL, parse_setting,
                           parse_section, &ctx, &error))
@@ -308,7 +308,7 @@ struct dict_connection *db_dict_init(const char *config_path)
        if (conn->set.uri == NULL)
                i_fatal("dict %s: Empty uri setting", config_path);
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.username = "";
        dict_set.base_dir = global_auth_settings->base_dir;
        if (dict_init(conn->set.uri, &dict_set, &conn->dict, &error) < 0)
index 78a9d56bd0f4f6c4395c83f2e22e80512aea6398..d8aaf41e466e80ab235f34f51fc28eb0ebb5e64c 100644 (file)
@@ -631,7 +631,7 @@ ldap_request_send_subquery(struct ldap_connection *conn,
        struct ldap_field_find_subquery_context ctx;
        string_t *tmp_str = t_str_new(64);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        t_array_init(&ctx.attr_names, 8);
        ctx.name = named_res->field->name;
 
@@ -912,7 +912,7 @@ static void ldap_input(struct ldap_connection *conn)
                if (conn->ld == NULL)
                        return;
 
-               memset(&timeout, 0, sizeof(timeout));
+               i_zero(&timeout);
                ret = ldap_result(conn->ld, LDAP_RES_ANY, 0, &timeout, &msg);
 #ifdef OPENLDAP_ASYNC_WORKAROUND
                if (ret == 0) {
@@ -1007,7 +1007,7 @@ static int db_ldap_bind_sasl(struct ldap_connection *conn)
        struct db_ldap_sasl_bind_context context;
        int ret;
 
-       memset(&context, 0, sizeof(context));
+       i_zero(&context);
        context.authcid = conn->set.dn;
        context.passwd = conn->set.dnpass;
        context.realm = conn->set.sasl_realm;
@@ -1219,7 +1219,7 @@ int db_ldap_connect(struct ldap_connection *conn)
 
        if (debug) {
                if (gettimeofday(&start, NULL) < 0)
-                       memset(&start, 0, sizeof(start));
+                       i_zero(&start);
        }
        i_assert(conn->pending_count == 0);
 
index acfc535a8b24a2cf26d2c5f4247cdda80eb7cb01..39f602653bf2d90551c38a790040b90d2c841d86 100644 (file)
@@ -189,7 +189,7 @@ static void main_preinit(void)
 
        services = read_global_settings();
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        mod_set.debug = global_auth_settings->debug;
@@ -220,7 +220,7 @@ void auth_module_load(const char *names)
 {
        struct module_dir_load_settings mod_set;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        mod_set.debug = global_auth_settings->debug;
index ffddf39286c5d4a197fe8d494704e0462a41d669..45c67d45b867ce52e9d55d403e59966747b46178 100644 (file)
@@ -261,7 +261,7 @@ pam_verify_plain_call(struct auth_request *request, const char *service,
        conv.conv = pam_userpass_conv;
        conv.appdata_ptr = &ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.request = request;
        ctx.pass = password;
 
index 996bb7f8af9a7aaad0566ff483ec8b914241ceda..5dc2cf8c5a8044da900c25664ff3222b053461cf 100644 (file)
@@ -76,7 +76,7 @@ static int config_connection_request(struct config_connection *conn,
 
        /* [<args>] */
        t_array_init(&modules, 4);
-       memset(&filter, 0, sizeof(filter));
+       i_zero(&filter);
        for (; *args != NULL; args++) {
                if (strncmp(*args, "service=", 8) == 0)
                        filter.service = *args + 8;
index 9f4d525e89e3a417b9aec8faf3fa04edd4b232f1..c0c0aa1a712834bd54a0c1f5b76b8be113c8b360 100644 (file)
@@ -215,7 +215,7 @@ config_filter_find_all(struct config_filter_context *ctx, pool_t pool,
        ARRAY_TYPE(const_string) service_names;
        unsigned int i;
 
-       memset(output_r, 0, sizeof(*output_r));
+       i_zero(output_r);
 
        p_array_init(&matches, pool, 8);
        p_array_init(&service_names, pool, 8);
index 10a70866d6c4aef4b2181b02a098b39a1291bfae..63421319f86edeb82e22c576acceb62728913e67 100644 (file)
@@ -966,7 +966,7 @@ int config_parse_file(const char *path, bool expand_values,
                }
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool_alloconly_create(MEMPOOL_GROWING"config file parser", 1024*256);
        ctx.path = path;
        ctx.hide_errors = fd == -1;
@@ -981,7 +981,7 @@ int config_parse_file(const char *path, bool expand_values,
                                             settings_parser_flags);
        }
 
-       memset(&root, 0, sizeof(root));
+       i_zero(&root);
        root.path = path;
        ctx.cur_input = &root;
        ctx.expand_values = expand_values;
@@ -1051,7 +1051,7 @@ void config_parse_load_modules(void)
        struct service_settings *const *services, *service_set;
        unsigned int i, count;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        modules = module_dir_load(CONFIG_MODULE_DIR, NULL, &mod_set);
        module_dir_init(modules);
index b1b88c178013c1c2393654cb86000460a0b34aaf..a461fab9c5d1f312ac8dc11aecfa5416376ec236 100644 (file)
@@ -609,7 +609,7 @@ static void hostname_verify_format(const char *arg)
        const char *host2;
        bool duplicates = FALSE;
 
-       memset(&fmt, 0, sizeof(fmt));
+       i_zero(&fmt);
        if (arg != NULL) {
                /* host%d, host%2d, host%02d */
                p = strchr(arg, '%');
@@ -727,7 +727,7 @@ int main(int argc, char *argv[])
                i_set_failure_exit_callback(failure_exit_callback);
        }
 
-       memset(&filter, 0, sizeof(filter));
+       i_zero(&filter);
        master_service = master_service_init("config", master_service_flags,
                                             &argc, &argv, "adf:hHm:nNpPexS");
        orig_config_path = master_service_get_config_path(master_service);
index cd1db6be6d5addaa148832658ed3e642a89cc7eb..344bfc805754ab4a46be592f431ae3f53aef0b66 100644 (file)
@@ -556,7 +556,7 @@ static bool old_auth_section(struct config_parser_context *ctx,
                return FALSE;
        }
        ctx->old->seen_auth_section = TRUE;
-       memset(&ctx->old->socket_set, 0, sizeof(ctx->old->socket_set));
+       i_zero(&ctx->old->socket_set);
 
        ctx->old->auth_section++;
        if ((strcmp(key, "passdb") == 0 || strcmp(key, "userdb") == 0) &&
@@ -636,7 +636,7 @@ static void socket_apply(struct config_parser_context *ctx)
                config_apply_line(ctx, "group",
                          t_strdup_printf("%s/group=%s", prefix, set->group), NULL);
        }
-       memset(&ctx->old->socket_set, 0, sizeof(ctx->old->socket_set));
+       i_zero(&ctx->old->socket_set);
 }
 
 bool old_settings_handle(struct config_parser_context *ctx,
index 80ae3abed3cdc9ea36aa440418ee7f368f5a1d6f..b2fc0e7eea3f303720c4f1a40328e452a79b9bac 100644 (file)
@@ -95,7 +95,7 @@ static int dict_connection_dict_init(struct dict_connection *conn)
        }
        uri = strlist[i+1];
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.value_type = conn->value_type;
        dict_set.username = conn->username;
        dict_set.base_dir = dict_settings->base_dir;
index f1d89fe27f9924bcd61b00b0666212e5e921fda7..ec4d3c6a9f6fdecf30ebfd2d88ce506bbca820b9 100644 (file)
@@ -106,7 +106,7 @@ static void main_init(void)
                                    NULL));
        }
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
 
index f897d58b0964dfc169d441264b8c540bc0bc8f74..ec26a4257c07e75e7fd83e6895fd574f29496ec4 100644 (file)
@@ -207,7 +207,7 @@ static void auth_input_line(const char *line, void *context)
                args++;
        }
 
-       memset(&temp_request, 0, sizeof(temp_request));
+       i_zero(&temp_request);
        for (; *args != NULL; args++) {
                if (strncmp(*args, "proxy", 5) == 0 &&
                    ((*args)[5] == '=' || (*args)[5] == '\0'))
index 197efedefc60b73a94fca2993bd84cb7dfcede53..2614bd274640254b48b795dde7818fabf849127d 100644 (file)
@@ -322,7 +322,7 @@ doveadm_http_server_command_execute(struct client_connection_http *conn)
        struct istream *is;
        const char *user;
        struct ioloop *ioloop,*prev_ioloop = current_ioloop;
-       memset(&cctx, 0, sizeof(cctx));
+       i_zero(&cctx);
 
        // create iostream
        doveadm_print_ostream = iostream_temp_create("/tmp/doveadm.", 0);
index 80adfb097aef41f5ee9a4d8a029e1d02bb516f5d..2cf136c8fbd8bc0215ecdcff455cdfabadd2dbd2 100644 (file)
@@ -287,7 +287,7 @@ static bool client_handle_command(struct client_connection *conn,
                i_error("doveadm client: No command given");
                return FALSE;
        }
-       memset(&cctx, 0, sizeof(cctx));
+       i_zero(&cctx);
        cctx.cli = FALSE;
        cctx.tcp_server = TRUE;
 
@@ -461,7 +461,7 @@ static int client_connection_read_settings(struct client_connection *conn)
        const char *error;
        void *set;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.service = "doveadm";
        input.local_ip = conn->local_ip;
index d26264279d2f830f6104d4fc482a0c459f7b618f..534ab74fe9de56c9c1dc4678373e852b29e8b88f 100644 (file)
@@ -295,7 +295,7 @@ cmd_user_mail_input(struct mail_storage_service_ctx *storage_service,
        pool_t pool;
        int ret;
 
-       memset(&service_input, 0, sizeof(service_input));
+       i_zero(&service_input);
        service_input.module = "mail";
        service_input.service = input->info.service;
        service_input.username = input->username;
@@ -375,7 +375,7 @@ static void cmd_user_ver2(struct doveadm_cmd_context *cctx)
        (void)doveadm_cmd_param_str(cctx, "field", &show_field);
        (void)doveadm_cmd_param_bool(cctx, "userdb-only", &userdb_only);
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        if (doveadm_cmd_param_array(cctx, "auth-info", &optval))
                for(;*optval != NULL; optval++)
                        auth_user_info_parse(&input.info, *optval);
index 9400d400f1533a33d13ae0369f4a67774a4cb68b..a5a49011b524dc1d330a6675ba8ba997d5417047 100644 (file)
@@ -179,7 +179,7 @@ static void auth_connected(struct auth_client *client,
        base64_resp = t_str_new(128);
        base64_encode(str_data(init_resp), str_len(init_resp), base64_resp);
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.mech = "PLAIN";
        info.service = input->info.service;
        info.local_ip = input->info.local_ip;
@@ -295,7 +295,7 @@ static void cmd_auth_cache_flush(int argc, char *argv[])
 
 static void authtest_input_init(struct authtest_input *input)
 {
-       memset(input, 0, sizeof(*input));
+       i_zero(input);
        input->info.service = "doveadm";
        input->info.debug = doveadm_settings->auth_debug;
 }
@@ -362,7 +362,7 @@ cmd_auth_master_input(const char *auth_master_socket_path,
        struct master_auth_request master_auth_req;
        buffer_t buf;
 
-       memset(&master_auth_req, 0, sizeof(master_auth_req));
+       i_zero(&master_auth_req);
        master_auth_req.tag = 1;
        master_auth_req.auth_pid = input->auth_pid;
        master_auth_req.auth_id = input->auth_id;
@@ -549,7 +549,7 @@ cmd_user_mail_input(struct mail_storage_service_ctx *storage_service,
        pool_t pool;
        int ret;
 
-       memset(&service_input, 0, sizeof(service_input));
+       i_zero(&service_input);
        service_input.module = "mail";
        service_input.service = input->info.service;
        service_input.username = input->username;
index 97fd6e7a9706f4f0c3e6b5d191d80af00b9620b3..89450f5cc43237e8d53bbf9e13c66ca5b2cb28b0 100644 (file)
@@ -380,7 +380,7 @@ doveadm_build_options(const struct doveadm_cmd_param par[],
        for(size_t i=0; par[i].name != NULL; i++) {
                struct option longopt;
 
-               memset(&longopt, 0, sizeof(longopt));
+               i_zero(&longopt);
                longopt.name = par[i].name;
                if (par[i].short_opt != '\0') {
                        longopt.val = par[i].short_opt;
index cb9e24021d9f4d61d0bf4e9d1d315a7271212502..991c8cce91b8525ddfa423712755aadf438735a0 100644 (file)
@@ -71,7 +71,7 @@ cmd_dict_init_full(int *argc, char **argv[], int own_arg_count, int key_arg_idx,
        }
 
        dict_drivers_register_builtin();
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.username = username;
        dict_set.base_dir = doveadm_settings->base_dir;
        if (dict_init(dict_uri, &dict_set, &dict, &error) < 0) {
index d3f4376cfda58efaaea3c75bf41e112db126ef65..c17c024611c3840b2470606c5f91ccf7a24ef587 100644 (file)
@@ -569,7 +569,7 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
        bool remote_only_changes;
        int ret = 0;
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        if (_ctx->cur_client_ip.family != 0) {
                /* include the doveadm client's IP address in the ps output */
                set.process_title_prefix = t_strdup_printf(
@@ -777,7 +777,7 @@ static int dsync_init_ssl_ctx(struct dsync_cmd_context *ctx,
        if (ctx->ssl_ctx != NULL)
                return 0;
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.ca_dir = mail_set->ssl_client_ca_dir;
        ssl_set.ca_file = mail_set->ssl_client_ca_file;
        ssl_set.verify_remote_cert = TRUE;
index 4796d8fb1e37976e34fe7af2ff91ea2f601857de..78d69d2e208d3385573e032fa1bffb461cabf23b 100644 (file)
@@ -35,12 +35,12 @@ cmd_fs_init(int *argc, char **argv[], int own_arg_count, doveadm_command_t *cmd)
                        fs_cmd_help(cmd);
        }
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.ca_dir = doveadm_settings->ssl_client_ca_dir;
        ssl_set.ca_file = doveadm_settings->ssl_client_ca_file;
        ssl_set.verbose = doveadm_debug;
 
-       memset(&fs_set, 0, sizeof(fs_set));
+       i_zero(&fs_set);
        fs_set.ssl_client_set = &ssl_set;
        fs_set.temp_dir = "/tmp";
        fs_set.base_dir = doveadm_settings->base_dir;
@@ -326,7 +326,7 @@ cmd_fs_delete_dir_recursive(struct fs *fs, unsigned int async_count,
        const char *fname, *const *fnamep;
        int ret;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.fs = fs;
        ctx.path_prefix = path_prefix;
        ctx.files_count = I_MAX(async_count, 1);
@@ -426,7 +426,7 @@ static void cmd_fs_delete_paths(int argc, char *argv[],
 
        fs = cmd_fs_init(&argc, &argv, 0, cmd_fs_delete);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.fs = fs;
        ctx.path_prefix = "";
        ctx.files_count = I_MAX(async_count, 1);
index 5698c37cca547ca71b52a84b5188558f858b78ad..3ba81525344b0533aae8f8c6afa98f975e09d619 100644 (file)
@@ -41,7 +41,7 @@ kick_aggregate_line(struct who_context *_ctx, const struct who_line *line)
        struct kick_pid *k_pid;
        struct kick_user new_user, *user;
 
-       memset(&new_user, 0, sizeof(new_user));
+       i_zero(&new_user);
 
        k_pid = hash_table_lookup(ctx->pids, POINTER_CAST(line->pid));
        if (k_pid == NULL) {
@@ -179,7 +179,7 @@ static void cmd_kick(struct doveadm_cmd_context *cctx)
        const char *const *masks;
        struct kick_context ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        if (!doveadm_cmd_param_str(cctx, "socket-path", &(ctx.who.anvil_path)))
                ctx.who.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
        (void)doveadm_cmd_param_bool(cctx, "force", &(ctx.force_kick));
index 7167734535ddc3b36224eecb3b4e41ddcfddd34a..a5fbad00ed721325b10bd9e2fc62c9a56b52ab79 100644 (file)
@@ -35,7 +35,7 @@ cmd_log_test(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
        master_service->flags |= MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR;
        master_service_init_log(master_service, "doveadm: ");
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        for (i = 0; i < LAST_LOG_TYPE; i++) {
                const char *prefix = failure_log_type_prefixes[i];
 
@@ -221,7 +221,7 @@ static void cmd_log_find(int argc, char *argv[])
        struct log_find_context ctx;
        unsigned int i;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool_alloconly_create("log file", 1024*32);
        hash_table_create(&ctx.files, ctx.pool, 0, str_hash, strcmp);
 
index e66e860de7c7ae083e288aaec9281c4c20c2c73e..ab0ba5ff08c3d2966da01020cb0b7239f5214a7a 100644 (file)
@@ -65,7 +65,7 @@ cmd_batch_add(struct batch_cmd_context *batchctx,
        if (cmd_ver2 == NULL)
                cmd = doveadm_mail_cmd_find_from_argv(argv[0], &argc, &argv);
        else {
-               memset(&tmpcmd, 0, sizeof(tmpcmd));
+               i_zero(&tmpcmd);
                tmpcmd.usage_args = cmd_ver2->usage;
                tmpcmd.name = cmd_ver2->name;
                tmpcmd.alloc = cmd_ver2->mail_cmd;
index c9a435c5c163ded1d2568171a1de15e6924e055e..a6d3807690da98e6bd47d58ef0d2bd54c191ca37 100644 (file)
@@ -533,10 +533,10 @@ static void parse_fetch_fields(struct fetch_cmd_context *ctx, const char *str)
        struct fetch_field hdr_field, body_field;
        struct imap_msgpart *msgpart;
 
-       memset(&hdr_field, 0, sizeof(hdr_field));
+       i_zero(&hdr_field);
        hdr_field.print = fetch_hdr_field;
 
-       memset(&body_field, 0, sizeof(body_field));
+       i_zero(&body_field);
        body_field.print = fetch_body_field;
 
        t_array_init(&ctx->fields, 32);
index ed2ea706aa556fbfe39490ec3e340a896d3aa080..cc8b2c7f9b251967010127af11d2ad57591fd950 100644 (file)
@@ -162,7 +162,7 @@ static void cmd_import_init_source_user(struct import_cmd_context *ctx, struct m
        const char *error;
 
        /* create a user for accessing the source storage */
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "mail";
        input.username = ctx->src_username != NULL ?
                         ctx->src_username :
index 19edba82ec34a6b49fe773f0e822ec7a435a5bdb..e02f82f63c536c51764935fb9a47665bc01bdd8f 100644 (file)
@@ -155,8 +155,8 @@ cmd_mailbox_status_run(struct doveadm_mail_cmd_context *_ctx,
        const struct mailbox_info *info;
        int ret = 0;
 
-       memset(&ctx->total_status, 0, sizeof(ctx->total_status));
-       memset(&ctx->total_metadata, 0, sizeof(ctx->total_metadata));
+       i_zero(&ctx->total_status);
+       i_zero(&ctx->total_metadata);
 
        iter = doveadm_mailbox_list_iter_init(_ctx, user, ctx->search_args,
                                              iter_flags);
index 5878138503a521db4dff23be64c78979fe34ed83..0a929d9ca38bbd9bd969580f52b25a5b1511fdb0 100644 (file)
@@ -194,7 +194,7 @@ doveadm_mail_server_user_get_host(struct doveadm_mail_cmd_context *ctx,
        /* make sure we have an auth connection */
        mail_storage_service_init_settings(ctx->storage_service, input);
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.service = master_service_get_name(master_service);
        info.local_ip = input->local_ip;
        info.remote_ip = input->remote_ip;
index 729ca0f9eff9124682a0df8ecc2f281cda41be98..24e3ca8fa550cc61fbfba585f55a6a68d1bea02d 100644 (file)
@@ -343,7 +343,7 @@ static void
 doveadm_cctx_to_storage_service_input(const struct doveadm_cmd_context *cctx,
                                        struct mail_storage_service_input *input_r)
 {
-       memset(input_r, 0, sizeof(*input_r));
+       i_zero(input_r);
        input_r->service = "doveadm";
        input_r->remote_ip = cctx->remote_ip;
        input_r->remote_port = cctx->remote_port;
@@ -641,7 +641,7 @@ doveadm_mail_cmd(const struct doveadm_mail_cmd *cmd, int argc, char *argv[])
        ctx->cli = TRUE;
        ctx->cur_username = getenv("USER");
 
-       memset(&cctx, 0, sizeof(cctx));
+       i_zero(&cctx);
 
        getopt_args = "AF:S:u:";
        /* keep context's getopt_args first in case it contains '+' */
@@ -907,7 +907,7 @@ void doveadm_mail_init(void)
        for (i = 0; i < N_ELEMENTS(mail_commands_ver2); i++)
                doveadm_cmd_register_ver2(mail_commands_ver2[i]);
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        mod_set.debug = doveadm_debug;
index 225437ecc50cf0874e7b72c16a0a744a0a75d5fa..de3ddbb8a5ece9c1cf30a2a0164df3035012eb16 100644 (file)
@@ -33,7 +33,7 @@ static void penalty_parse_line(const char *line, struct penalty_line *line_r)
        const char *last_penalty_str = args[2];
        const char *last_update_str = args[3];
 
-       memset(line_r, 0, sizeof(*line_r));
+       i_zero(line_r);
 
        (void)net_addr2ip(ident, &line_r->ip);
        if (str_to_uint(penalty_str, &line_r->penalty) < 0 ||
@@ -94,7 +94,7 @@ static void cmd_penalty(struct doveadm_cmd_context *cctx)
        struct penalty_context ctx;
        const char *netmask;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        if (!doveadm_cmd_param_str(cctx, "socket-path", &(ctx.anvil_path)))
                ctx.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
 
index 8d4ae8642fc3f7451e0d25e3cb24201366c0d1f7..a4ff9cad74eac11f4eebab45e506742e2becf38a 100644 (file)
@@ -28,7 +28,7 @@ void doveadm_print_formatted_set_format(const char *format)
 
 static void doveadm_print_formatted_init(void)
 {
-       memset(&ctx,0,sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool_alloconly_create("doveadm formatted print", 1024);
        ctx.buf = str_new(ctx.pool, 256);
        p_array_init(&ctx.headers, ctx.pool, 8);
@@ -39,7 +39,7 @@ static void
 doveadm_print_formatted_header(const struct doveadm_print_header *hdr)
 {
        struct var_expand_table entry;
-       memset(&entry, 0, sizeof(entry));
+       i_zero(&entry);
        entry.key = '\0';
        entry.long_key = p_strdup(ctx.pool, hdr->key);
        entry.value = NULL;
index 54ee3dffca9f61bb1a93724c23c5a538613d7f68..6ccf1ead779496db86421fc924b221f0eecbe4b2 100644 (file)
@@ -27,7 +27,7 @@ static void doveadm_print_json_flush_internal(void);
 
 static void doveadm_print_json_init(void)
 {
-       memset(&ctx,0,sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool_alloconly_create("doveadm json print", 1024);
        ctx.str = str_new(ctx.pool, 256);
        p_array_init(&ctx.headers, ctx.pool, 1);
index cc9b389f46473174a01f8a4357c0772256a37aae..75faaa91957ba8f72320cfcba09514db1684ace0 100644 (file)
@@ -39,7 +39,7 @@ void doveadm_print_header(const char *key, const char *title,
 
        i_assert(title != NULL);
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.key = key;
        hdr.title = title;
        hdr.flags = flags;
index f848034d3e1c1c363c8fbba9e5d486fcdbf0847c..8e3caeb1425520e890b74e1d8d23b74b3c1090be 100644 (file)
@@ -32,7 +32,7 @@ static void cmd_pw(int argc, char *argv[])
        random_init();
        password_schemes_init();
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        mod_set.ignore_dlopen_errors = TRUE;
index 187eb490ee7123ae3e03111a2d769eb530a17183..e2dbca16acbe8706f082e8b68bfaa443aaa1f8b9 100644 (file)
@@ -467,7 +467,7 @@ static void stats_top(const char *path, const char *sort_type)
 {
        struct top_context ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.path = path;
        ctx.fd = doveadm_connect(path);
        ctx.prev_pool = pool_alloconly_create("stats top", 1024*16);
index 31b0eab7a1658709824c8c89d3d40dfeebe374fb..b2b9dc852ca227678023579b61b29297a887fba6 100644 (file)
@@ -27,7 +27,7 @@ void doveadm_load_modules(void)
        /* some doveadm plugins have dependencies to mail plugins. we can load
           only those whose dependencies have been loaded earlier, the rest are
           ignored. */
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        mod_set.debug = doveadm_debug;
index 79b852c123eded4612b5957644d4ce9bd48a2236..7e67e246d6cb4b6e651b6c866fb4294baa047e90 100644 (file)
@@ -58,7 +58,7 @@ static int who_parse_line(const char *line, struct who_line *line_r)
        const char *refcount_str = args[2];
        const char *p, *ip_str;
 
-       memset(line_r, 0, sizeof(*line_r));
+       i_zero(line_r);
 
        /* ident = service/ip/username (imap, pop3)
           or      service/username (lmtp) */
@@ -288,7 +288,7 @@ static void cmd_who(struct doveadm_cmd_context *cctx)
        struct who_context ctx;
        bool separate_connections = FALSE;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        if (!doveadm_cmd_param_str(cctx, "socket-path", &(ctx.anvil_path)))
                ctx.anvil_path = t_strconcat(doveadm_settings->base_dir, "/anvil", NULL);
        (void)doveadm_cmd_param_bool(cctx, "separate-connections", &separate_connections);
index b4e45b47cb89764c6f1cca5ff295705036bad6dd..3ae28f3114f400f7b45d51fa14ecfefdfb8b7918 100644 (file)
@@ -162,7 +162,7 @@ static void cmd_zlibconnect(int argc ATTR_UNUSED, char *argv[])
        i_info("Connected to %s port %u. Ctrl-D starts compression",
               net_ip2addr(&ips[0]), port);
 
-       memset(&client, 0, sizeof(client));
+       i_zero(&client);
        client.fd = fd;
        client.input = i_stream_create_fd(fd, (size_t)-1);
        client.output = o_stream_create_fd(fd, 0);
index c6203f3b1726fc5784147c0a18f2ccde2651bdff..487386f4cd56733e383f692f637a426b9abcfa6e 100644 (file)
@@ -255,7 +255,7 @@ static void doveadm_read_settings(void)
        const struct doveadm_settings *set;
        const char *error;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "doveadm";
        input.service = "doveadm";
@@ -298,7 +298,7 @@ int main(int argc, char *argv[])
        bool quick_init = FALSE;
        int c;
 
-       memset(&cctx,0,sizeof(cctx));
+       i_zero(&cctx);
        cctx.cli = TRUE;
 
        i_set_failure_exit_callback(failure_exit_callback);
index 7ebde7aa5aaec705218982629cb50170e78e2481..b95b4d4fe393fad34c4f4d7d1e46b3c949303d69 100644 (file)
@@ -17,7 +17,7 @@ sync_create_box(struct dsync_brain *brain, struct mailbox *box,
        const char *errstr;
        int ret;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        memcpy(update.mailbox_guid, mailbox_guid, sizeof(update.mailbox_guid));
        update.uid_validity = uid_validity;
 
@@ -72,7 +72,7 @@ sync_create_box(struct dsync_brain *brain, struct mailbox *box,
                                guid_128_to_string(metadata.guid),
                                guid_128_to_string(mailbox_guid));
                }
-               memset(&update, 0, sizeof(update));
+               i_zero(&update);
                memcpy(update.mailbox_guid, mailbox_guid,
                       sizeof(update.mailbox_guid));
                if (mailbox_update(box, &update) < 0) {
index e62a658e387922e4a9648aad9f89ef86973e9ba0..71ebe27468cf049fa4dbf42083a745fd613d979f 100644 (file)
@@ -154,13 +154,13 @@ dsync_brain_sync_mailbox_init(struct dsync_brain *brain,
        dsync_mailbox_cache_field_dup(&brain->local_dsync_box.cache_fields,
                                      &local_dsync_box->cache_fields,
                                      brain->dsync_box_pool);
-       memset(&brain->remote_dsync_box, 0, sizeof(brain->remote_dsync_box));
+       i_zero(&brain->remote_dsync_box);
 
        state = dsync_mailbox_state_find(brain, local_dsync_box->mailbox_guid);
        if (state != NULL)
                brain->mailbox_state = *state;
        else {
-               memset(&brain->mailbox_state, 0, sizeof(brain->mailbox_state));
+               i_zero(&brain->mailbox_state);
                memcpy(brain->mailbox_state.mailbox_guid,
                       local_dsync_box->mailbox_guid,
                       sizeof(brain->mailbox_state.mailbox_guid));
@@ -421,7 +421,7 @@ static int dsync_box_get(struct mailbox *box, struct dsync_mailbox *dsync_box_r,
 
        i_assert(status.uidvalidity != 0 || status.messages == 0);
 
-       memset(dsync_box_r, 0, sizeof(*dsync_box_r));
+       i_zero(dsync_box_r);
        memcpy(dsync_box_r->mailbox_guid, metadata.guid,
               sizeof(dsync_box_r->mailbox_guid));
        dsync_box_r->uid_validity = status.uidvalidity;
@@ -681,7 +681,7 @@ bool dsync_brain_mailbox_update_pre(struct dsync_brain *brain,
        bool ret = TRUE;
 
        *reason_r = NULL;
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
 
        if (local_box->uid_validity != remote_box->uid_validity) {
                /* Keep the UIDVALIDITY for the mailbox that has more
@@ -730,7 +730,7 @@ dsync_brain_slave_send_mailbox_lost(struct dsync_brain *brain,
                        brain->master_brain ? 'M' : 'S',
                        guid_128_to_string(dsync_box->mailbox_guid));
        }
-       memset(&delete_box, 0, sizeof(delete_box));
+       i_zero(&delete_box);
        memcpy(delete_box.mailbox_guid, dsync_box->mailbox_guid,
               sizeof(delete_box.mailbox_guid));
        t_array_init(&delete_box.cache_fields, 0);
index 6db6c26725ed9cb9ab762e73bdbadfe5a490882d..25d531ed3eb883c360baace54f7bed6a0f175063 100644 (file)
@@ -231,7 +231,7 @@ static void dsync_brain_sync_half_finished(struct dsync_brain *brain)
                return;
 
        /* finished with this mailbox */
-       memset(&state, 0, sizeof(state));
+       i_zero(&state);
        memcpy(state.mailbox_guid, brain->local_dsync_box.mailbox_guid,
               sizeof(state.mailbox_guid));
        state.last_uidvalidity = brain->local_dsync_box.uid_validity;
index 7c681c087db138c186535eae871b8b4cf2e00dcc..403500c96ca2a39c44debcda764dd8c1cbfa43ce 100644 (file)
@@ -244,7 +244,7 @@ dsync_brain_master_init(struct mail_user *user, struct dsync_ibc *ibc,
        }
        dsync_brain_mailbox_trees_init(brain);
 
-       memset(&ibc_set, 0, sizeof(ibc_set));
+       i_zero(&ibc_set);
        ibc_set.hostname = my_hostdomain();
        ibc_set.sync_ns_prefixes = sync_ns_str == NULL ?
                NULL : str_c(sync_ns_str);
@@ -295,7 +295,7 @@ dsync_brain_slave_init(struct mail_user *user, struct dsync_ibc *ibc,
                brain->verbose_proctitle = FALSE;
        }
 
-       memset(&ibc_set, 0, sizeof(ibc_set));
+       i_zero(&ibc_set);
        ibc_set.hdr_hash_v2 = TRUE;
        ibc_set.hostname = my_hostdomain();
        dsync_ibc_send_handshake(ibc, &ibc_set);
index c29ada53438c291197fdf3e41ccd57f6fbb81ff3..c15da477611588c5804f1229070f8a3defc706cd 100644 (file)
@@ -933,7 +933,7 @@ dsync_ibc_stream_recv_mailbox_state(struct dsync_ibc *_ibc,
        const char *value;
        enum dsync_ibc_recv_ret ret;
 
-       memset(state_r, 0, sizeof(*state_r));
+       i_zero(state_r);
 
        ret = dsync_ibc_stream_input_next(ibc, ITEM_MAILBOX_STATE, &decoder);
        if (ret != DSYNC_IBC_RECV_RET_OK)
@@ -1339,7 +1339,7 @@ parse_cache_field(struct dsync_ibc_stream *ibc, struct dsync_mailbox *box,
                return -1;
        }
 
-       memset(&field, 0, sizeof(field));
+       i_zero(&field);
        value = dsync_deserializer_decode_get(decoder, "name");
        field.name = p_strdup(ibc->ret_pool, value);
 
index 7bea5e89f1088c3a755a84014bc3a75db8c72173..713f0d72350e1c7d2481596a8401697c58f7ef86 100644 (file)
@@ -47,7 +47,7 @@ int dsync_mail_get_hdr_hash(struct mail *mail, unsigned int version,
        input = i_stream_create_lf(hdr_input);
 
        md5_init(&md5_ctx);
-       memset(&hash_ctx, 0, sizeof(hash_ctx));
+       i_zero(&hash_ctx);
        while ((sret = i_stream_read_more(input, &data, &size)) > 0) {
                message_header_hash_more(&hash_ctx, &hash_method_md5, &md5_ctx,
                                         version, data, size);
@@ -68,7 +68,7 @@ int dsync_mail_fill(struct mail *mail, bool minimal_fill,
 {
        const char *guid;
 
-       memset(dmail_r, 0, sizeof(*dmail_r));
+       i_zero(dmail_r);
 
        if (mail_get_special(mail, MAIL_FETCH_GUID, &guid) < 0) {
                *error_field_r = "GUID";
index 924a65216304c0f95a986b3c57a99b36c40acbff..b2ebf5cb278032142c6b65d62af94fd88cef3571 100644 (file)
@@ -208,7 +208,7 @@ search_update_flag_change_guid(struct dsync_mailbox_exporter *exporter,
                return -1;
        if (ret == 0) {
                /* the message was expunged during export */
-               memset(change, 0, sizeof(*change));
+               i_zero(change);
                change->type = DSYNC_MAIL_CHANGE_TYPE_EXPUNGE;
                change->uid = mail->uid;
 
@@ -633,7 +633,7 @@ dsync_mailbox_export_iter_next_attr(struct dsync_mailbox_exporter *exporter)
                }
 
                attr = &exporter->attr;
-               memset(attr, 0, sizeof(*attr));
+               i_zero(attr);
                attr->type = exporter->attr_type;
                attr->value = p_strdup(exporter->pool, value.value);
                attr->value_stream = value.value_stream;
@@ -907,7 +907,7 @@ int dsync_mailbox_export_next_mail(struct dsync_mailbox_exporter *exporter,
           return them */
        guids = array_get(&exporter->expunged_guids, &count);
        if (exporter->expunged_guid_idx < count) {
-               memset(&exporter->dsync_mail, 0, sizeof(exporter->dsync_mail));
+               i_zero(&exporter->dsync_mail);
                exporter->dsync_mail.guid =
                        guids[exporter->expunged_guid_idx++];
                *mail_r = &exporter->dsync_mail;
index da296122ae1f695fcd7eef0d5f0d60cac5854af2..84ed98fa50bcf86db415987e341404c6151376a6 100644 (file)
@@ -527,7 +527,7 @@ dsync_mailbox_import_attribute_real(struct dsync_mailbox_importer *importer,
        if (ignore)
                return 0;
 
-       memset(&value, 0, sizeof(value));
+       i_zero(&value);
        value.value = attr->value;
        value.value_stream = attr->value_stream;
        value.last_change = attr->last_change;
@@ -778,13 +778,13 @@ static bool dsync_mailbox_try_save_cur(struct dsync_mailbox_importer *importer,
        int diff;
        bool remote_saved;
 
-       memset(&m1, 0, sizeof(m1));
+       i_zero(&m1);
        if (importer->cur_mail != NULL) {
                m1.guid = importer->mails_have_guids ?
                        importer->cur_guid : importer->cur_hdr_hash;
                m1.uid = importer->cur_mail->uid;
        }
-       memset(&m2, 0, sizeof(m2));
+       i_zero(&m2);
        if (save_change != NULL) {
                m2.guid = importer->mails_have_guids ?
                        save_change->guid : save_change->hdr_hash;
@@ -2710,7 +2710,7 @@ static int dsync_mailbox_import_finish(struct dsync_mailbox_importer *importer,
        if (ret == 0) {
                /* update mailbox metadata if we successfully saved
                   everything. */
-               memset(&update, 0, sizeof(update));
+               i_zero(&update);
                update.min_next_uid = importer->remote_uid_next;
                update.min_first_recent_uid =
                        I_MIN(importer->last_common_uid+1,
index 4ccc17f831ba7507b4d935014327a44c85c2fe55..8ec4ea17db434356ad7a248dac7d6fca0833f5b6 100644 (file)
@@ -243,7 +243,7 @@ dsync_mailbox_tree_fix_guid_duplicate(struct dsync_mailbox_tree *tree,
        const char *change_vname;
        int ret = 0;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        guid_128_generate(update.mailbox_guid);
 
        /* just in case the duplication exists in both sides,
index 8fc8a99e663e9799ee91cf1e3c0e3aa7a2202144..2f4c26c62e4947ab632eacb868fc3c41994e9424 100644 (file)
@@ -47,7 +47,7 @@ export_change_get(struct dsync_transaction_log_scan *ctx, uint32_t uid,
        } else if (type == DSYNC_MAIL_CHANGE_TYPE_EXPUNGE) {
                /* expunge overrides flag changes */
                orig_guid = change->guid;
-               memset(change, 0, sizeof(*change));
+               i_zero(change);
                change->type = type;
                change->uid = uid;
                change->guid = orig_guid;
index c9ace77b72fa707c64fe99211b61d0224e210ba3..07b60454464995af1d1c538c81cb15f35e5ec9da 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
                }
        }
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "doveadm";
        input.service = "doveadm";
index e7ab99e31a22a8a37fd47d13033be23ad13c1b43..4b2d379094886dd4f44cfe2043671f7fff6e7980 100644 (file)
@@ -419,7 +419,7 @@ static int server_connection_read_settings(struct server_connection *conn)
        in_port_t port;
        void *set;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.service = "doveadm";
 
@@ -461,7 +461,7 @@ static int server_connection_init_ssl(struct server_connection *conn)
        if (conn->server->ssl_ctx == NULL)
                return 0;
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.verify_remote_cert = TRUE;
        ssl_set.verbose_invalid_cert = TRUE;
 
index df7d7616390080247c249ccc92f7c8fa28ee1651..319617ffb630ade11bef60a87d4785bd1118f0c6 100644 (file)
@@ -49,7 +49,7 @@ imap_hibernate_client_parse_input(const char *const *args, pool_t pool,
        const char *key, *value;
        unsigned int peer_dev_major = 0, peer_dev_minor = 0;
 
-       memset(state_r, 0, sizeof(*state_r));
+       i_zero(state_r);
        if (args[0] == NULL) {
                *error_r = "Missing username in input";
                return -1;
index 70fe33b1ec39917c2a202defd8c8a47f2d4d253d..983804122faa395724cc4ddfc7ee343b15d70f81 100644 (file)
@@ -57,7 +57,7 @@ void imap_client_auth_result(struct client *client,
                */
                referral = t_str_new(128);
 
-               memset(&url, 0, sizeof(url));
+               i_zero(&url);
                url.userid = reply->destuser;
                url.auth_type = client->auth_mech_name;
                url.host.name = reply->host;
index fd6a55227e80d80c9ec1eb39c05fe588f3b6948f..558d47ccb7ceb8ca433acdc6a9e1e1e9f784b261 100644 (file)
@@ -114,7 +114,7 @@ static int proxy_write_login(struct imap_client *client, string_t *str)
        }
 
        i_assert(client->common.proxy_sasl_client == NULL);
-       memset(&sasl_set, 0, sizeof(sasl_set));
+       i_zero(&sasl_set);
        sasl_set.authid = client->common.proxy_master_user != NULL ?
                client->common.proxy_master_user : client->common.proxy_user;
        sasl_set.authzid = client->common.proxy_user;
index ffbbc6f90036c1099f89d4d7edee734c30a83b6e..3d4543c0ed6800d554db3bdc3f53760f4197923a 100644 (file)
@@ -577,7 +577,7 @@ client_handle_user_command(struct client *client, const char *cmd,
        }
 
        /* lookup user */
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "imap-urlauth-worker";
        input.service = "imap-urlauth-worker";
        input.username = args[0];
@@ -639,7 +639,7 @@ client_handle_user_command(struct client *client, const char *cmd,
                return 0;
        }
 
-       memset(&config, 0, sizeof(config));
+       i_zero(&config);
        config.url_host = set->imap_urlauth_host;
        config.url_port = set->imap_urlauth_port;
        config.access_user = client->access_user;
index 0e6310dda92211881abfdc5f5244cdd40d996537..a4332fb69ee36b54ff539b0c76e2d4693ff3241b 100644 (file)
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
        const char *auth_socket_path = "auth-master";
        int c;
 
-       memset(&login_set, 0, sizeof(login_set));
+       i_zero(&login_set);
        login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT;
 
        if (IS_STANDALONE() && getuid() == 0 &&
@@ -219,7 +219,7 @@ int main(int argc, char *argv[])
        }
        master_service_init_log(master_service, "imap-urlauth: ");
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "imap-urlauth";
        input.service = "imap-urlauth";
index a574e2dfd2fa41d0009c740811513d7cdb7b936a..73db4969c1c64fd1b113a9d1223b8805e42fae42 100644 (file)
@@ -26,7 +26,7 @@ imap_fetch_cmd_init_handler(struct imap_fetch_context *ctx,
 {
        struct imap_fetch_init_context init_ctx;
 
-       memset(&init_ctx, 0, sizeof(init_ctx));
+       i_zero(&init_ctx);
        init_ctx.fetch_ctx = ctx;
        init_ctx.pool = ctx->ctx_pool;
        init_ctx.name = name;
@@ -285,7 +285,7 @@ bool cmd_fetch(struct client_command_context *cmd)
        }
 
        if (send_vanished) {
-               memset(&qresync_args, 0, sizeof(qresync_args));
+               i_zero(&qresync_args);
                if (imap_fetch_send_vanished(client, client->mailbox,
                                             search_args, &qresync_args) < 0) {
                        mail_search_args_unref(&search_args);
index 725e4d5fb70b01ab3d7eb22dee8f986647d956a4..e2a7b33efa6fa68214577af6ad6be7b9425aed77 100644 (file)
@@ -407,8 +407,8 @@ imap_notify_box_send_status(struct client_command_context *cmd,
            mailbox_equals(cmd->client->mailbox, info->ns, info->vname))
                return;
 
-       memset(&items, 0, sizeof(items));
-       memset(&result, 0, sizeof(result));
+       i_zero(&items);
+       i_zero(&result);
 
        items.status = STATUS_UIDVALIDITY | STATUS_UIDNEXT |
                STATUS_MESSAGES | STATUS_UNSEEN;
index d1d01e223542da1999841f9f9bc77b1a5da89227..4ba1cef5f46c892f348532a96b274aca7275e7e4 100644 (file)
@@ -245,7 +245,7 @@ static int select_qresync(struct imap_select_context *ctx)
        search_args->args->value.seqset = ctx->qresync_known_uids;
        imap_search_add_changed_since(search_args, ctx->qresync_modseq);
 
-       memset(&qresync_args, 0, sizeof(qresync_args));
+       i_zero(&qresync_args);
        qresync_args.qresync_sample_seqset = &ctx->qresync_sample_seqset;
        qresync_args.qresync_sample_uidset = &ctx->qresync_sample_uidset;
 
index 98b9dc2307b704175e470ac84514d860a963c6f0..f92b7a5c5697b865233f928822cb57e531153b3b 100644 (file)
@@ -137,7 +137,7 @@ cmd_setmetadata_entry_read_stream(struct imap_setmetadata_context *ctx)
                        return 1;
                }
 
-               memset(&value, 0, sizeof(value));
+               i_zero(&value);
                value.value_stream = ctx->input;
                if (imap_metadata_set(ctx->trans, ctx->entry_name, &value) < 0) {
                        /* delay reporting the failure so we'll finish
@@ -172,7 +172,7 @@ cmd_setmetadata_entry(struct imap_setmetadata_context *ctx,
                /* we have the value already */
                if (ctx->failed)
                        return 1;
-               memset(&value, 0, sizeof(value));
+               i_zero(&value);
                value.value = imap_arg_as_nstring(entry_value);
                ret = imap_metadata_set(ctx->trans, entry_name, &value);
                if (ret < 0) {
index 16fc26e2f161210062518fb45e14868a6c6ba570..1ae3b110a2566c6058e9641f74d3705a1ac6d58a 100644 (file)
@@ -152,7 +152,7 @@ bool cmd_store(struct client_command_context *cmd)
        if (ret <= 0)
                return ret < 0;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.cmd = cmd;
        if (!store_parse_args(&ctx, ++args)) {
                mail_search_args_unref(&search_args);
index 8c88a778483fc29e38b4dab9eaa3183cefc02827..8f29a6c7d365cc2f7d3fd4aea66f35f09700b22e 100644 (file)
@@ -54,7 +54,7 @@ static void client_init_urlauth(struct client *client)
 {
        struct imap_urlauth_config config;
 
-       memset(&config, 0, sizeof(config));
+       i_zero(&config);
        config.url_host = client->set->imap_urlauth_host;
        config.url_port = client->set->imap_urlauth_port;
        config.socket_path = t_strconcat(client->user->set->base_dir,
index fac0301216887affbd8658404b679829c9eba835..0701e952a11f01a7b7a86a1bf79ddf9b6180e892 100644 (file)
@@ -336,7 +336,7 @@ client_get_keyword_names(struct client *client, ARRAY_TYPE(keywords) *dest,
 
 void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str)
 {
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ctx->str = str;
        ctx->last_uid = (uint32_t)-1;
 }
index e6719404debb81cde5054a21c5946136e7ce6b3f..0cc5e03c524ba04b164e0d014044f47c5ae5b743 100644 (file)
@@ -95,7 +95,7 @@ void command_register(const char *name, command_func_t *func,
 {
        struct command cmd;
 
-       memset(&cmd, 0, sizeof(cmd));
+       i_zero(&cmd);
        cmd.name = name;
        cmd.func = func;
        cmd.flags = flags;
index ebac6a5f5ea2760e1ebfe4e5d73e48584142e4cc..0c374c43f85379e6ad6736f6691f936c74dca22e 100644 (file)
@@ -70,7 +70,7 @@ void imap_fetch_init_nofail_handler(struct imap_fetch_context *ctx,
 {
        struct imap_fetch_init_context init_ctx;
 
-       memset(&init_ctx, 0, sizeof(init_ctx));
+       i_zero(&init_ctx);
        init_ctx.fetch_ctx = ctx;
        init_ctx.pool = ctx->ctx_pool;
 
@@ -86,7 +86,7 @@ int imap_fetch_att_list_parse(struct client *client, pool_t pool,
        struct imap_fetch_init_context init_ctx;
        const char *str;
 
-       memset(&init_ctx, 0, sizeof(init_ctx));
+       i_zero(&init_ctx);
        init_ctx.fetch_ctx = imap_fetch_alloc(client, pool);
        init_ctx.pool = pool;
        init_ctx.args = list;
@@ -155,7 +155,7 @@ void imap_fetch_add_handler(struct imap_fetch_init_context *ctx,
                }
        }
 
-       memset(&h, 0, sizeof(h));
+       i_zero(&h);
        h.handler = handler;
        h.context = context;
        h.buffered = (flags & IMAP_FETCH_HANDLER_FLAG_BUFFERED) != 0;
@@ -355,7 +355,7 @@ void imap_fetch_begin(struct imap_fetch_context *ctx, struct mailbox *box,
        i_assert(!ctx->state.fetching);
 
         imap_fetch_init(ctx);
-        memset(&ctx->state, 0, sizeof(ctx->state));
+        i_zero(&ctx->state);
 
        if (array_count(&ctx->all_headers) > 0 &&
            ((ctx->fetch_data & (MAIL_FETCH_STREAM_HEADER |
index e0a08da1febc5bce42d78fdf0d26039aac4c739e..cd10ecae03bafc748f863f22e9e4f231bd5675a4 100644 (file)
@@ -57,8 +57,8 @@ imap_master_client_parse_input(const char *const *args, pool_t pool,
        const char *key, *value;
        unsigned int peer_dev_major = 0, peer_dev_minor = 0;
 
-       memset(input_r, 0, sizeof(*input_r));
-       memset(master_input_r, 0, sizeof(*master_input_r));
+       i_zero(input_r);
+       i_zero(master_input_r);
        master_input_r->client_input = buffer_create_dynamic(pool, 64);
        master_input_r->client_output = buffer_create_dynamic(pool, 16);
        master_input_r->state = buffer_create_dynamic(pool, 512);
index 1fc16729df0f074c1419d371442257d165a3e3b9..d570fa9fd9ac2ad78855c4ce8302f34b5efb4e2e 100644 (file)
@@ -52,7 +52,7 @@ static int imap_notify_status(struct imap_notify_namespace *notify_ns,
        enum mail_error error;
        int ret = 1;
 
-       memset(&items, 0, sizeof(items));
+       i_zero(&items);
        if ((client->enabled_features & MAILBOX_FEATURE_CONDSTORE) != 0)
                items.status |= STATUS_HIGHESTMODSEQ;
 
index 81a16785c2678a69bc126812250d4b5728b7fe0e..333346042badd4208d2cfbab54ccff67284343bd 100644 (file)
@@ -494,7 +494,7 @@ import_state_mailbox_struct(const unsigned char *data, size_t size,
 {
        const unsigned char *p = data, *end = data + size;
 
-       memset(state_r, 0, sizeof(*state_r));
+       i_zero(state_r);
        t_array_init(&state_r->recent_uids, 8);
 
        /* vname */
index 43037e2f2dc9d760585db6790f0dadc88b3e9eea..cf7567be5bb5c62962721e94e52456cf165d3947 100644 (file)
@@ -19,7 +19,7 @@ int imap_status_parse_items(struct client_command_context *cmd,
                return -1;
        }
 
-       memset(items_r, 0, sizeof(*items_r));
+       i_zero(items_r);
        for (; !IMAP_ARG_IS_EOL(args); args++) {
                if (!imap_arg_get_atom(args, &item)) {
                        /* list may contain only atoms */
index 65e173cc10b3183ef3bcbd1ab74e14b261dcddef..14694e568964a2de28a4b85022ee7fd1ccb5f294 100644 (file)
@@ -146,7 +146,7 @@ client_parse_input(const unsigned char *data, size_t len,
 
        i_assert(len > 0);
 
-       memset(input_r, 0, sizeof(*input_r));
+       i_zero(input_r);
 
        if (data[0] == '1')
                input_r->send_untagged_capability = TRUE;
@@ -176,7 +176,7 @@ client_add_input(struct client *client, const unsigned char *client_input,
                        i_panic("Couldn't add client input to stream");
        } else {
                /* IMAPLOGINTAG environment is compatible with mailfront */
-               memset(&input, 0, sizeof(input));
+               i_zero(&input);
                input.tag = getenv("IMAPLOGINTAG");
        }
 
@@ -277,7 +277,7 @@ static void main_stdio_run(const char *username)
        struct mail_storage_service_input input;
        const char *value, *error, *input_base64;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "imap";
        input.username = username != NULL ? username : getenv("USER");
        if (input.username == NULL && IS_STANDALONE())
@@ -312,7 +312,7 @@ login_client_connected(const struct master_login_client *login_client,
        enum mail_auth_request_flags flags;
        const char *error;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "imap";
        input.local_ip = login_client->auth_req.local_ip;
        input.remote_ip = login_client->auth_req.remote_ip;
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
        const char *username = NULL, *auth_socket_path = "auth-master";
        int c;
 
-       memset(&login_set, 0, sizeof(login_set));
+       i_zero(&login_set);
        login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT;
        login_set.request_auth_token = TRUE;
 
index f766fc603984f0c996e8efb13178de0f6ae93f15..ec2bc097879fd6136d1abacdba3f540baca68cd8 100644 (file)
@@ -34,7 +34,7 @@ static void drop_privileges(void)
                struct master_service_settings_input input;
                struct master_service_settings_output output;
 
-               memset(&input, 0, sizeof(input));
+               i_zero(&input);
                input.module = "mail";
                input.service = "indexer-worker";
                (void)master_service_settings_read(master_service,
index c3bbce0e8bf26abdbc54eab5d1aa62dc2e4d2973..1c2eb3421293e5e9d73c5f15551d007cba448cfa 100644 (file)
@@ -208,7 +208,7 @@ master_connection_input_line(struct master_connection *conn, const char *line)
                return -1;
        }
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "mail";
        input.service = "indexer-worker";
        input.username = args[0];
index 964850f82af4eb623c829fbd73d648e3e44fd777..ff85b5c14ff6be3f3cdc5e4ae75a7a19abe65427 100644 (file)
@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
                MASTER_SERVICE_FLAG_NO_INIT_DATASTACK_FRAME,
                &argc, &argv, "a:d:ef:m:p:r:");
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.session = mail_deliver_session_init();
        ctx.pool = ctx.session->pool;
        ctx.dest_mailbox_name = "INBOX";
@@ -400,7 +400,7 @@ int main(int argc, char *argv[])
        }
        master_service_init_finish(master_service);
 
-       memset(&service_input, 0, sizeof(service_input));
+       i_zero(&service_input);
        service_input.module = "lda";
        service_input.service = "lda";
        service_input.username = user;
index 599112c09e79ae59e497a1e11c7e27c84f7dbed4..9eab3a01923b98b7cbf3c6dce33e2bdfb27240dc 100644 (file)
@@ -488,7 +488,7 @@ int auth_master_user_lookup(struct auth_master_connection *conn,
                return 0;
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.conn = conn;
        ctx.return_value = -1;
        ctx.pool = pool;
@@ -527,7 +527,7 @@ int auth_master_user_lookup(struct auth_master_connection *conn,
 void auth_user_fields_parse(const char *const *fields, pool_t pool,
                            struct auth_user_reply *reply_r)
 {
-       memset(reply_r, 0, sizeof(*reply_r));
+       i_zero(reply_r);
        reply_r->uid = (uid_t)-1;
        reply_r->gid = (gid_t)-1;
        p_array_init(&reply_r->extra_fields, pool, 64);
@@ -565,7 +565,7 @@ int auth_master_pass_lookup(struct auth_master_connection *conn,
                return 0;
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.conn = conn;
        ctx.return_value = -1;
        ctx.pool = pool;
@@ -618,7 +618,7 @@ int auth_master_cache_flush(struct auth_master_connection *conn,
        struct auth_master_cache_ctx ctx;
        string_t *str;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.conn = conn;
 
        conn->reply_callback = auth_cache_flush_reply_callback;
index ba3b7346bb6e629a7f8b1c5ba9c6343848f0fa5e..fc53fe471b11d3d464b9c7ea11038f622955ed81 100644 (file)
@@ -39,7 +39,7 @@ auth_server_input_mech(struct auth_server_connection *conn,
                return -1;
        }
 
-       memset(&mech_desc, 0, sizeof(mech_desc));
+       i_zero(&mech_desc);
        mech_desc.name = p_strdup(conn->pool, args[0]);
 
        if (strcmp(mech_desc.name, "PLAIN") == 0)
index 2aa87a1bfc11f661015c422041d8d95b47f92bae..49d53640839e831e2e47c75a715dab26d0a25f40 100644 (file)
@@ -258,7 +258,7 @@ int dcrypt_gnutls_pbkdf2(const unsigned char *password, size_t password_len, con
                struct hmac_sha512_ctx ctx;
                hmac_sha512_set_key(&ctx, password_len, password);
                PBKDF2(&ctx, hmac_sha512_update, hmac_sha512_digest, 64, rounds, salt_len, salt, result_len, buf);
-               memset(&ctx, 0, sizeof(ctx));
+               i_zero(&ctx);
        } else {
                *error_r = "Unsupported algorithm";
                return -1;
index a58de4bbbaa63a745bcbff065034db0a352b6bf9..54afe3989f36449c6bdb3805e7b26890c61ec348 100644 (file)
@@ -731,7 +731,7 @@ static
 bool dcrypt_openssl_generate_keypair(struct dcrypt_keypair *pair_r, enum dcrypt_key_type kind, unsigned int bits, const char *curve, const char **error_r)
 {
        EVP_PKEY *pkey = NULL;
-       memset(pair_r, 0, sizeof(*pair_r));
+       i_zero(pair_r);
        if (kind == DCRYPT_KEY_RSA) {
                if (dcrypt_openssl_generate_rsa_key(bits, &pkey, error_r)) {
                        pair_r->priv = i_new(struct dcrypt_private_key, 1);
index 148b8026a4e80e5a445b43622daef5c0456d3b3a..1463ff76d6ef4bbb0016e2c7e9896acf452401f2 100644 (file)
@@ -25,7 +25,7 @@ bool dcrypt_initialize(const char *backend, const struct dcrypt_settings *set, c
 
        const char *implementation = t_strconcat("dcrypt_",backend,NULL);
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
        if (module_dir_try_load_missing(&dcrypt_module, set->module_dir,
@@ -231,7 +231,7 @@ bool dcrypt_pbkdf2(const unsigned char *password, size_t password_len, const uns
 bool dcrypt_keypair_generate(struct dcrypt_keypair *pair_r, enum dcrypt_key_type kind, unsigned int bits, const char *curve, const char **error_r)
 {
        i_assert(dcrypt_vfs != NULL);
-       memset(pair_r, 0, sizeof(*pair_r));
+       i_zero(pair_r);
        return dcrypt_vfs->generate_keypair(pair_r, kind, bits, curve, error_r);
 }
 
index 8fca4ddb88d088d783838f8fb7f16f44794ceb7f..6da5b7506c45d436f718ac8bdbac5d3236c70f80 100644 (file)
@@ -638,7 +638,7 @@ void test_get_info_pw_encrypted(void) {
        test_begin("test_get_info_pw_encrypted");
 
        struct dcrypt_keypair p1;
-       memset(&p1, 0, sizeof(p1));
+       i_zero(&p1);
        const char *error;
        bool ret = dcrypt_keypair_generate(&p1, DCRYPT_KEY_EC, 0, "secp521r1", &error);
        test_assert(ret == TRUE);
index cc074729834abef3aff9029adb1fcd77b0660fce..6cb919acdf0294ccdec0cb4b21b3962dae9be233 100644 (file)
@@ -43,7 +43,7 @@ fs_dict_init(struct dict *driver, const char *uri,
                fs_args = p+1;
        }
 
-       memset(&fs_set, 0, sizeof(fs_set));
+       i_zero(&fs_set);
        fs_set.username = set->username;
        fs_set.base_dir = set->base_dir;
        if (fs_init(fs_driver, fs_args, &fs_set, &fs, error_r) < 0)
index 5fd9a4ddb4831c34b1be85f0d4054d0268c5606c..048a70dda9fe14b1657c0aa02f40f6f44b87cfd3 100644 (file)
@@ -37,7 +37,7 @@ cdb_dict_init(struct dict *driver, const char *uri,
        dict->flag = CDB_WITH_NULL | CDB_WITHOUT_NULL;
 
        /* initialize cdb to 0 (unallocated) */
-       memset(&dict->cdb, 0, sizeof(dict->cdb));
+       i_zero(&dict->cdb);
 
        dict->fd = open(dict->path, O_RDONLY);
        if (dict->fd == -1) {
index d2e411d0259414d4579ec2e9d9fdcf770b25f7e7..bfb7b2c6de53376fbdb8110f90fb137c6dae3f1a 100644 (file)
@@ -927,7 +927,7 @@ client_dict_lookup_async_callback(struct client_dict_cmd *cmd,
        struct client_dict *dict = cmd->dict;
        struct dict_lookup_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        if (error != NULL) {
                result.ret = -1;
                result.error = error;
@@ -1013,7 +1013,7 @@ static int client_dict_lookup(struct dict *_dict, pool_t pool, const char *key,
 {
        struct client_dict_sync_lookup lookup;
 
-       memset(&lookup, 0, sizeof(lookup));
+       i_zero(&lookup);
        lookup.ret = -2;
 
        client_dict_lookup_async(_dict, key, client_dict_lookup_callback, &lookup);
index f48962d1eaef1d27cba7ddb9dd0d0e76a607066b..81ceb054ba060b6d5bef2af03461f8fff3268ac7 100644 (file)
@@ -48,7 +48,7 @@ static int associate_key(DB *pdb ATTR_UNUSED,
                         const DBT *pkey ATTR_UNUSED,
                         const DBT *pdata, DBT *skey)
 {
-       memset(skey, 0, sizeof(*skey));
+       i_zero(skey);
        skey->data = pdata->data;
        skey->size = pdata->size;
        return 0;
@@ -234,8 +234,8 @@ static int db_dict_lookup(struct dict *_dict, pool_t pool,
        uint32_t value;
        int ret;
 
-       memset(&pkey, 0, sizeof(pkey));
-       memset(&pdata, 0, sizeof(pdata));
+       i_zero(&pkey);
+       i_zero(&pdata);
 
        pkey.data = (char *)key;
        pkey.size = strlen(key);
@@ -267,9 +267,9 @@ static int db_dict_iterate_next(struct db_dict_iterate_context *ctx,
        DBT pkey, pdata, skey;
        int ret;
 
-       memset(&pkey, 0, sizeof(pkey));
-       memset(&pdata, 0, sizeof(pdata));
-       memset(&skey, 0, sizeof(skey));
+       i_zero(&pkey);
+       i_zero(&pdata);
+       i_zero(&skey);
 
        if ((ctx->flags & DICT_ITERATE_FLAG_SORT_BY_VALUE) != 0) {
                while ((ret = ctx->cursor->c_pget(ctx->cursor, &skey,
@@ -417,8 +417,8 @@ static void db_dict_set(struct dict_transaction_context *_ctx,
        struct db_dict *dict = (struct db_dict *)_ctx->dict;
        DBT dkey, ddata;
 
-       memset(&dkey, 0, sizeof(dkey));
-       memset(&ddata, 0, sizeof(ddata));
+       i_zero(&dkey);
+       i_zero(&ddata);
 
        dkey.data = (char *)key;
        dkey.size = strlen(key);
@@ -448,7 +448,7 @@ static void db_dict_unset(struct dict_transaction_context *_ctx,
        struct db_dict *dict = (struct db_dict *)_ctx->dict;
        DBT dkey;
 
-       memset(&dkey, 0, sizeof(dkey));
+       i_zero(&dkey);
        dkey.data = (char *)key;
        dkey.size = strlen(key);
        
index 6598adefd3306e11cd65ac8aa95477bd5325a5fb..bafc02ed9a3e2a02239b436299d67432212d419e 100644 (file)
@@ -633,7 +633,7 @@ file_dict_transaction_commit(struct dict_transaction_context *_ctx,
        struct dict_commit_result result;
        bool atomic_inc_not_found;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        if (file_dict_write_changes(ctx, &atomic_inc_not_found, &result.error) < 0)
                result.ret = DICT_COMMIT_RET_FAILED;
        else if (atomic_inc_not_found)
index 6efa15dc0f4fd2528818409bfeac09d34dd7e64f..e1bfb3e2f4f26efb5f47da92161e2697b5deb823 100644 (file)
@@ -637,7 +637,7 @@ memcached_ascii_transaction_commit(struct dict_transaction_context *_ctx,
        struct dict_commit_result result = { DICT_COMMIT_RET_OK, NULL };
 
        if (_ctx->changed) {
-               memset(&commit_ctx, 0, sizeof(commit_ctx));
+               i_zero(&commit_ctx);
                commit_ctx.dict = dict;
                commit_ctx.memctx = ctx;
                commit_ctx.callback = callback;
index 7480bdfcc182ddcd9b38d921d951a15e46f92137..23f775eedc36eb91c8c89681662fa53c4354e9fb 100644 (file)
@@ -321,7 +321,7 @@ memcached_dict_lookup(struct dict *_dict, pool_t pool, const char *key,
                                       dict->conn.cmd->data,
                                       dict->conn.cmd->used);
 
-                       memset(&dict->conn.reply, 0, sizeof(dict->conn.reply));
+                       i_zero(&dict->conn.reply);
                        io_loop_run(dict->ioloop);
                }
                timeout_remove(&to);
index 1c4dd82b2f420c1048650f126c64da7c767e65f7..610456dd2c63acbf693d4ec1985775261225e42c 100644 (file)
@@ -158,7 +158,7 @@ static const char *dict_sql_map_finish(struct setting_parser_ctx *ctx)
                        return "Missing fields for pattern variables";
        }
        array_append(&ctx->set->maps, &ctx->cur_map, 1);
-       memset(&ctx->cur_map, 0, sizeof(ctx->cur_map));
+       i_zero(&ctx->cur_map);
        return NULL;
 }
 
@@ -259,7 +259,7 @@ dict_sql_settings_read(const char *path, const char **error_r)
        if (cache != NULL)
                return cache->set;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        pool = pool_alloconly_create("dict sql settings", 1024);
        ctx.pool = pool;
        ctx.set = p_new(pool, struct dict_sql_settings, 1);
index 56713d558d64d52c1bd52c09f532b2518c120c07..1a8a355b8faa1452e11cc3a7201c367a365644aa 100644 (file)
@@ -460,7 +460,7 @@ sql_dict_lookup_async_callback(struct sql_result *sql_result,
 {
        struct dict_lookup_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        result.ret = sql_result_next_row(sql_result);
        if (result.ret < 0)
                result.error = sql_result_get_error(sql_result);
@@ -492,7 +492,7 @@ sql_dict_lookup_async(struct dict *_dict, const char *key,
        if (sql_lookup_get_query(dict, key, query, &map, &error) < 0) {
                struct dict_lookup_result result;
 
-               memset(&result, 0, sizeof(result));
+               i_zero(&result);
                result.ret = -1;
                result.error = error;
                callback(&result, context);
@@ -800,7 +800,7 @@ sql_dict_transaction_commit_callback(const struct sql_commit_result *sql_result,
 {
        struct dict_commit_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        if (sql_result->error == NULL)
                result.ret = sql_dict_transaction_has_nonexistent(ctx) ?
                        DICT_COMMIT_RET_NOTFOUND : DICT_COMMIT_RET_OK;
@@ -835,7 +835,7 @@ sql_dict_transaction_commit(struct dict_transaction_context *_ctx, bool async,
        const char *error;
        struct dict_commit_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        result.ret = DICT_COMMIT_RET_FAILED;
        result.error = t_strdup(ctx->error);
 
@@ -1034,7 +1034,7 @@ static void sql_dict_set(struct dict_transaction_context *_ctx,
        field.map = map;
        field.value = value;
 
-       memset(&build, 0, sizeof(build));
+       i_zero(&build);
        build.dict = dict;
        t_array_init(&build.fields, 1);
        array_append(&build.fields, &field, 1);
@@ -1117,7 +1117,7 @@ static void sql_dict_atomic_inc_real(struct sql_dict_transaction_context *ctx,
        field.map = map;
        field.value = t_strdup_printf("%lld", diff);
 
-       memset(&build, 0, sizeof(build));
+       i_zero(&build);
        build.dict = dict;
        t_array_init(&build.fields, 1);
        array_append(&build.fields, &field, 1);
@@ -1214,7 +1214,7 @@ static void sql_dict_atomic_inc(struct dict_transaction_context *_ctx,
                struct dict_sql_build_query_field *field;
                const char *query, *error;
 
-               memset(&build, 0, sizeof(build));
+               i_zero(&build);
                build.dict = dict;
                t_array_init(&build.fields, 1);
                build.extra_values = &values;
index 903bbb04583f4d6ff6063fa26dddc80a9d29ba38..951669c40c1447bdbab7fc75c3bba6e214be3eae 100644 (file)
@@ -128,7 +128,7 @@ void dict_lookup_async(struct dict *dict, const char *key,
        if (dict->v.lookup_async == NULL) {
                struct dict_lookup_result result;
 
-               memset(&result, 0, sizeof(result));
+               i_zero(&result);
                result.ret = dict_lookup(dict, pool_datastack_create(),
                                         key, &result.value, &result.error);
                callback(&result, context);
@@ -245,7 +245,7 @@ int dict_transaction_commit(struct dict_transaction_context **_ctx,
 
        *_ctx = NULL;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        ctx->dict->v.transaction_commit(ctx, FALSE,
                dict_transaction_commit_sync_callback, &result);
        *error_r = t_strdup(result.error);
index 44ced0235b7ad4c57211f662d47f25bd6f10cb18..12ca2e158f1bb4865fa0f9ec32ebe36269e55ae6 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
        prefix = argv[1];
        uri = argv[2];
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.base_dir = "/var/run/dovecot";
        set.username = "testuser";
 
index fd814c7e15ee4af3a84c7d7399e287efbed50331..e71d32be06c4076d917bb945247d7a30bc57d10b 100644 (file)
@@ -71,7 +71,7 @@ static void dns_client_disconnect(struct dns_client *client, const char *error)
                client->fd = -1;
        }
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        result.ret = EAI_FAIL;
        result.error = error;
 
@@ -339,7 +339,7 @@ dns_client_lookup_common(struct dns_client *client,
        struct dns_lookup_result result;
        int ret;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        result.ret = EAI_FAIL;
 
        if ((ret = dns_client_send_request(client, cmd, &result.error)) <= 0) {
index 8391adc7e612834d6131a345fc94a7a58810d325..58b47406fc765dd50b0fdad505fe18f6bd6cbf24 100644 (file)
@@ -110,7 +110,7 @@ static void fs_class_try_load_plugin(const char *driver)
        struct module_dir_load_settings mod_set;
        const struct fs *fs_class;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.ignore_missing = TRUE;
 
index 7d68dde21da752eed9c5afd7f83ca9df6361277a..53458008681eacda3585b705fcda0e0fd3e0b50d 100644 (file)
@@ -69,7 +69,7 @@ fs_dict_init(struct fs *_fs, const char *args, const struct fs_settings *set)
                return -1;
        }
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.username = set->username;
        dict_set.base_dir = set->base_dir;
 
@@ -245,7 +245,7 @@ static int fs_dict_stat(struct fs_file *_file, struct stat *st_r)
 {
        struct dict_fs_file *file = (struct dict_fs_file *)_file;
 
-       memset(st_r, 0, sizeof(*st_r));
+       i_zero(st_r);
 
        if (fs_dict_lookup(file) < 0)
                return -1;
index da416116720f905b08a153b5d72be6ce038a13e2..cff787a0676ac1137ab9cf3402eea9ec3507cb23 100644 (file)
@@ -596,7 +596,7 @@ fs_posix_lock(struct fs_file *_file, unsigned int secs, struct fs_lock **lock_r)
        struct posix_fs_lock fs_lock, *ret_lock;
        int ret = -1;
 
-       memset(&fs_lock, 0, sizeof(fs_lock));
+       i_zero(&fs_lock);
        fs_lock.lock.file = _file;
 
        switch (fs->lock_method) {
@@ -621,7 +621,7 @@ fs_posix_lock(struct fs_file *_file, unsigned int secs, struct fs_lock **lock_r)
 #endif
                break;
        case FS_POSIX_LOCK_METHOD_DOTLOCK:
-               memset(&dotlock_set, 0, sizeof(dotlock_set));
+               i_zero(&dotlock_set);
                dotlock_set.stale_timeout = FS_POSIX_DOTLOCK_STALE_TIMEOUT_SECS;
                dotlock_set.use_excl_lock = TRUE;
                dotlock_set.timeout = secs;
index 2da75bff9cd8510f7dba9deb4e0a0f0f09359383..a4792eb13e95bf48c8019ad69b1d35d36b226418 100644 (file)
@@ -83,7 +83,7 @@ void test_fs_async(const char *test_name, enum fs_properties properties,
        struct test_fs *test_fs;
        const char *error;
 
-       memset(&fs_set, 0, sizeof(fs_set));
+       i_zero(&fs_set);
        if (fs_init(driver, args, &fs_set, &fs, &error) < 0)
                i_fatal("fs_init() failed: %s", error);
 
index ea73cc84e3d0b8619fdff7412c6eca4362056fdd..b15ff01372446a36388a9ce0f54e48da234db47d 100644 (file)
@@ -234,7 +234,7 @@ static int fs_test_stat(struct fs_file *_file, struct stat *st_r)
                errno = ENOENT;
                return -1;
        }
-       memset(st_r, 0, sizeof(*st_r));
+       i_zero(st_r);
        st_r->st_size = file->contents->used;
        return 0;
 }
index a1038193a8cff8f3169dd157c253e2e81867f8dc..391598390685059958fa64b8b1a386a91fd78830 100644 (file)
@@ -177,7 +177,7 @@ int fts_icu_transliterator_create(const char *id,
        UErrorCode err = U_ZERO_ERROR;
        UParseError perr;
        ARRAY_TYPE(icu_utf16) id_utf16;
-       memset(&perr, 0, sizeof(perr));
+       i_zero(&perr);
 
        t_array_init(&id_utf16, strlen(id));
        fts_icu_utf8_to_utf16(&id_utf16, id);
index bc54d8a2c60565728de228dbe2e1075833aa3653..18852efd846817e504f7452086e701fbc3734140 100644 (file)
@@ -96,7 +96,7 @@ http_parse_auth_params(struct http_parser *parser,
        unsigned int count = 0;
        int ret;
 
-       memset(&param, 0, sizeof(param));
+       i_zero(&param);
        while ((ret=http_parse_auth_param
                (parser, &param.name, &param.value)) > 0) {
                if (!array_is_created(params))
@@ -149,7 +149,7 @@ int http_auth_parse_challenges(const unsigned char *data, size_t size,
        for (;;) {
                struct http_auth_challenge chlng;
 
-               memset(&chlng, 0, sizeof(chlng));
+               i_zero(&chlng);
 
                /* auth-scheme */
                if ((ret=http_parse_token(&parser, &chlng.scheme)) <= 0) {
@@ -208,7 +208,7 @@ int http_auth_parse_credentials(const unsigned char *data, size_t size,
           auth-scheme    = token
         */
 
-       memset(crdts, 0, sizeof(*crdts));
+       i_zero(crdts);
 
        /* auth-scheme */
        if (http_parse_token(&parser, &crdts->scheme) <= 0)
@@ -382,7 +382,7 @@ http_auth_params_clone(pool_t pool,
        array_foreach(src, sparam) {
                struct http_auth_param nparam;
 
-               memset(&nparam, 0, sizeof(nparam));
+               i_zero(&nparam);
                nparam.name = p_strdup(pool, sparam->name);
                nparam.value = p_strdup(pool, sparam->value);
 
@@ -443,12 +443,12 @@ http_auth_credentials_clone(pool_t pool,
 void http_auth_basic_challenge_init(struct http_auth_challenge *chlng,
        const char *realm)
 {
-       memset(chlng, 0, sizeof(*chlng));
+       i_zero(chlng);
        chlng->scheme = "Basic";
        if (realm != NULL) {
                struct http_auth_param param;
 
-               memset(&param, 0, sizeof(param));
+               i_zero(&param);
                param.name = "realm";
                param.value = t_strdup(realm);
 
@@ -470,7 +470,7 @@ void http_auth_basic_credentials_init(struct http_auth_credentials *crdts,
        auth = t_strconcat(username, ":", password, NULL);
        base64_encode(auth, strlen(auth), data);
 
-       memset(crdts, 0, sizeof(*crdts));
+       i_zero(crdts);
        crdts->scheme = "Basic";
        crdts->data = str_c(data);
 }
index 11222cfd5cfd296db277728901ed461044c0d2f3..a6c88f4f79d2bd04b6ad53743c6f43fd0a8594e5 100644 (file)
@@ -1114,7 +1114,7 @@ http_client_connection_start_tunnel(struct http_client_connection **_conn,
        i_assert(conn->tunneling);
 
        /* claim connection streams */
-       memset(tunnel, 0, sizeof(*tunnel));
+       i_zero(tunnel);
        tunnel->input = conn->conn.input;
        tunnel->output = conn->conn.output;
        tunnel->fd_in = conn->conn.fd_in;
@@ -1165,7 +1165,7 @@ http_client_connection_ready(struct http_client_connection *conn)
                        http_client_request_ref(req);
                        conn->tunneling = TRUE;
 
-                       memset(&response, 0, sizeof(response));
+                       i_zero(&response);
                        response.status = 200;
                        response.reason = "OK";
 
@@ -1214,7 +1214,7 @@ http_client_connection_ssl_init(struct http_client_connection *conn,
 
        i_assert(conn->client->ssl_ctx != NULL);
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        if (!conn->client->set.ssl->allow_invalid_cert) {
                ssl_set.verbose_invalid_cert = TRUE;
                ssl_set.verify_remote_cert = TRUE;
index 92c889862a057d94c64e0f1f0ba8d96ddf0f5c18..8348f10740de111058123cb6d039c3434a0450cd 100644 (file)
@@ -118,7 +118,7 @@ static void http_client_host_lookup
        } else if (client->set.dns_client_socket_path != NULL) {
                http_client_host_debug(host,
                        "Performing asynchronous DNS lookup");
-               memset(&dns_set, 0, sizeof(dns_set));
+               i_zero(&dns_set);
                dns_set.dns_client_socket_path =
                        client->set.dns_client_socket_path;
                if (client->set.connect_timeout_msecs > 0)
index 9767f5d0c633b1a97622f4bd435fe5b7e039a9aa..98d94689ed17a2def157c801978debcf4ae41e7e 100644 (file)
@@ -669,7 +669,7 @@ http_client_request_get_peer_addr(const struct http_client_request *req,
        /* the IP address may be unassigned in the returned peer address, since
           that is only available at this stage when the target URL has an
           explicit IP address. */
-       memset(addr, 0, sizeof(*addr));
+       i_zero(addr);
        if (host_socket != NULL) {
                addr->type = HTTP_CLIENT_PEER_ADDR_UNIX;
                addr->a.un.path = host_socket;          
index 896ebb3036e3d62bb5e753838854dcd8e6b67147..eceb73e1d9618a428891c30c3b08a50953123ec9 100644 (file)
@@ -434,7 +434,7 @@ bool http_date_parse(const unsigned char *data, size_t size,
        struct http_date_parser parser;
        time_t timestamp;
        
-       memset(&parser, 0, sizeof(parser));
+       i_zero(&parser);
        parser.cur = data;
        parser.end = data + size;
 
index 272e72e2d8e623005fe9a7d0b6eb5dcfdfe6a1bd..6f691f00dac95c638692b42d4e39bf942e1ad86a 100644 (file)
@@ -18,7 +18,7 @@ void http_message_parser_init(struct http_message_parser *parser,
        struct istream *input, const struct http_header_limits *hdr_limits,
        uoff_t max_payload_size, bool lenient)
 {
-       memset(parser, 0, sizeof(*parser));
+       i_zero(parser);
        parser->input = input;
        i_stream_ref(parser->input);
        if (hdr_limits != NULL)
@@ -53,7 +53,7 @@ void http_message_parser_restart(struct http_message_parser *parser,
 
        if (parser->msg.pool != NULL)
                pool_unref(&parser->msg.pool);
-       memset(&parser->msg, 0, sizeof(parser->msg));
+       i_zero(&parser->msg);
        if (pool == NULL) {
                parser->msg.pool = pool_alloconly_create("http_message", 4096);
        } else {
index 4aaf368e762edd701558d9f82be91a96dad87a41..65b1b685b5db5281eb5cf39e488b8e47c627ce6e 100644 (file)
@@ -74,7 +74,7 @@ const unsigned char _http_char_lookup[256] = {
 void http_parser_init(struct http_parser *parser,
                        const unsigned char *data, size_t size)
 {
-       memset(parser, 0, sizeof(*parser));
+       i_zero(parser);
        parser->begin = data;
        parser->cur = data;
        parser->end = data + size;
index b5a21fd252c0a3e06f671ea6f1affc5ca58b1ae2..dcb0b1051816a59808da4d91dabaa03b02a7ab66 100644 (file)
@@ -49,7 +49,7 @@ http_request_parser_init(struct istream *input,
                hdr_limits = limits->header;
                max_payload_size = limits->max_payload_size;
        } else {
-               memset(&hdr_limits, 0, sizeof(hdr_limits));
+               i_zero(&hdr_limits);
                max_payload_size = 0;
        }
 
@@ -572,7 +572,7 @@ int http_request_parse_next(struct http_request_parser *parser,
                return -1;
        }
 
-       memset(request, 0, sizeof(*request));
+       i_zero(request);
 
        if (http_url_request_target_parse(parser->request_target, hdr->value,
                parser->parser.msg.pool, &request->target, &error) < 0) {
index a212e471dd80d6dd8f197526023d9f34f50cdb28..1d849baa623176197f4421e9352415967244b393 100644 (file)
@@ -385,7 +385,7 @@ int http_response_parse_next(struct http_response_parser *parser,
 
        parser->state = HTTP_RESPONSE_PARSE_STATE_INIT;
 
-       memset(response, 0, sizeof(*response));
+       i_zero(response);
        response->status = parser->response_status;
        response->reason = parser->response_reason;
        response->version_major = parser->parser.msg.version_major;
index 666bdcbcddf4a172a1d62d8f46530ffec4eb3f40..e255a6bbb0ec87befa039e99ede1ee4e29a88aa6 100644 (file)
@@ -11,7 +11,7 @@ void
 http_response_init(struct http_response *resp,
        unsigned int status, const char *reason)
 {
-       memset(resp, 0, sizeof(*resp));
+       i_zero(resp);
        resp->version_major = 1;
        resp->version_minor = 1;
        resp->date = ioloop_time;
index de5e224d18b488d5839ddedb1c7d250fa8dc2bed..7025b7c7e21b8a44be2445d400c82f99c4427bfd 100644 (file)
@@ -1219,7 +1219,7 @@ void http_server_connection_tunnel(struct http_server_connection **_conn,
        /* preserve statistics */
        http_server_connection_update_stats(conn);
 
-       memset(&tunnel, 0, sizeof(tunnel));
+       i_zero(&tunnel);
        tunnel.input = conn->conn.input;
        tunnel.output = conn->conn.output;
        tunnel.fd_in = conn->conn.fd_in;
index d05eb3bc32de045ce14f1dbefbcbcfb4c7a8e83a..6cb0242475dfd34ef1d85ca3932f2c7254c75221 100644 (file)
@@ -59,7 +59,7 @@ http_server_response_create(struct http_server_request *req,
                resp = req->response;
                i_assert(!resp->submitted);
                http_server_response_free(resp);
-               memset(resp, 0, sizeof(*resp));
+               i_zero(resp);
        }
 
        resp->request = req;
@@ -327,7 +327,7 @@ http_server_response_output_payload(
        http_server_request_ref(req);
        resp->payload_blocking = TRUE;
 
-       memset(&rpay, 0, sizeof(rpay));
+       i_zero(&rpay);
        rpay.resp = resp;
 
        if (iov == NULL) {
@@ -428,7 +428,7 @@ int http_server_response_send_payload(struct http_server_response **_resp,
 
        i_assert(data != NULL);
 
-       memset(&iov, 0, sizeof(iov));
+       i_zero(&iov);
        iov.iov_base = data;
        iov.iov_len = size;
        ret = http_server_response_output_payload(&resp, &iov, 1);
index 1bb2ced78308a6c5c8dedce505711d752df9da23..5ab880cbe35b2204a8d89e0f1e5ed131d7335207 100644 (file)
@@ -335,7 +335,7 @@ int http_url_parse(const char *url, struct http_url *base,
           flags may also dictate whether relative URLs are allowed/required. */
        i_assert((flags & HTTP_URL_PARSE_SCHEME_EXTERNAL) == 0 || base == NULL);
 
-       memset(&url_parser, 0, sizeof(url_parser));
+       i_zero(&url_parser);
        uri_parser_init(&url_parser.parser, pool, url);
 
        url_parser.url = p_new(pool, struct http_url, 1);
@@ -359,7 +359,7 @@ int http_url_request_target_parse(const char *request_target,
        struct uri_authority auth;
        struct http_url base;
 
-       memset(&url_parser, 0, sizeof(url_parser));
+       i_zero(&url_parser);
        parser = &url_parser.parser;
        uri_parser_init(parser, pool, host_header);
 
@@ -382,11 +382,11 @@ int http_url_request_target_parse(const char *request_target,
                return 0;
        }
 
-       memset(&base, 0, sizeof(base));
+       i_zero(&base);
        base.host = auth.host;
        base.port = auth.port;
 
-       memset(parser, 0, sizeof(*parser));
+       i_zero(parser);
        uri_parser_init(parser, pool, request_target);
 
        url_parser.url = p_new(pool, struct http_url, 1);
@@ -412,7 +412,7 @@ int http_url_request_target_parse(const char *request_target,
 void http_url_copy_authority(pool_t pool, struct http_url *dest,
        const struct http_url *src)
 {
-       memset(dest, 0, sizeof(*dest));
+       i_zero(dest);
        uri_host_copy(pool, &dest->host, &src->host);
        dest->port = src->port;
        dest->have_ssl = src->have_ssl;
index 430c706fe1c5277de625364726b464a951df91bf..616d2a9453ce5f855c5d116d09dfe21fd4f885f6 100644 (file)
@@ -97,7 +97,7 @@ static void test_http_auth_challenges_valid(void)
 
                test_begin(t_strdup_printf("http auth challenges valid [%d]", i));
 
-               memset(&out, 0, sizeof(out));
+               i_zero(&out);
                result = (http_auth_parse_challenges
                        ((const unsigned char *)challenges_in, strlen(challenges_in), 
                                &out) > 0);
index 3ba05a53f48e6319b8a5e86aa8c1cad369bdfa9c..858a5fa3b6aaf8d9eb14bf6dda54c6ba3b83386c 100644 (file)
@@ -2493,7 +2493,7 @@ static void
 test_client_defaults(struct http_client_settings *http_set)
 {
        /* client settings */
-       memset(http_set, 0, sizeof(*http_set));
+       i_zero(http_set);
        http_set->max_idle_time_msecs = 5*1000;
        http_set->max_parallel_connections = 1;
        http_set->max_pipelined_requests = 1;
@@ -2797,7 +2797,7 @@ int main(int argc, char *argv[])
   }
 
        /* listen on localhost */
-       memset(&bind_ip, 0, sizeof(bind_ip));
+       i_zero(&bind_ip);
        bind_ip.family = AF_INET;
        bind_ip.u.ip4.s_addr = htonl(INADDR_LOOPBACK);  
 
index f6f69b1cdb6e4fe136705d53bd9addaaa7e7678a..60c9979d6f537c0ecfbc54c09c8408c7a85be6d2 100644 (file)
@@ -352,7 +352,7 @@ int main(int argc, char *argv[])
           the binary in all systems (but is in others! so linking
           safe-memset.lo directly causes them to fail.) If safe_memset() isn't
           included, libssl-iostream plugin loading fails. */
-       safe_memset(&dns_set, 0, sizeof(dns_set));
+       i_zero_safe(&dns_set);
        dns_set.dns_client_socket_path = "/var/run/dovecot/dns-client";
        dns_set.timeout_msecs = 30*1000;
        dns_set.idle_timeout_msecs = UINT_MAX;
@@ -361,12 +361,12 @@ int main(int argc, char *argv[])
        if (dns_client_connect(dns_client, &error) < 0)
                i_fatal("Couldn't initialize DNS client: %s", error);
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.allow_invalid_cert = TRUE;
        ssl_set.ca_dir = "/etc/ssl/certs"; /* debian */
        ssl_set.ca_file = "/etc/pki/tls/cert.pem"; /* redhat */
 
-       memset(&http_set, 0, sizeof(http_set));
+       i_zero(&http_set);
        http_set.ssl = &ssl_set;
        http_set.dns_client = dns_client;
        http_set.max_idle_time_msecs = 5*1000;
index e812e64da61f96f1a886c1c78487eb977e7c785d..4cbff770e96ef8158c6bdf86a756f1517ed410e9 100644 (file)
@@ -1259,13 +1259,13 @@ static void test_run_sequential(
        /* download files from blocking server */
 
        /* server settings */
-       memset(&http_server_set, 0, sizeof(http_server_set));
+       i_zero(&http_server_set);
        http_server_set.max_pipelined_requests = 0;
        http_server_set.debug = debug;
        http_server_set.request_limits.max_payload_size = (uoff_t)-1;
 
        /* client settings */
-       memset(&http_client_set, 0, sizeof(http_client_set));
+       i_zero(&http_client_set);
        http_client_set.max_idle_time_msecs = 5*1000;
        http_client_set.max_parallel_connections = 1;
        http_client_set.max_pipelined_requests = 1;
@@ -1290,13 +1290,13 @@ static void test_run_pipeline(
        /* download files from blocking server */
 
        /* server settings */
-       memset(&http_server_set, 0, sizeof(http_server_set));
+       i_zero(&http_server_set);
        http_server_set.max_pipelined_requests = 4;
        http_server_set.debug = debug;
        http_server_set.request_limits.max_payload_size = (uoff_t)-1;
 
        /* client settings */
-       memset(&http_client_set, 0, sizeof(http_client_set));
+       i_zero(&http_client_set);
        http_client_set.max_idle_time_msecs = 5*1000;
        http_client_set.max_parallel_connections = 1;
        http_client_set.max_pipelined_requests = 8;
@@ -1321,13 +1321,13 @@ static void test_run_parallel(
        /* download files from blocking server */
 
        /* server settings */
-       memset(&http_server_set, 0, sizeof(http_server_set));
+       i_zero(&http_server_set);
        http_server_set.max_pipelined_requests = 4;
        http_server_set.debug = debug;
        http_server_set.request_limits.max_payload_size = (uoff_t)-1;
 
        /* client settings */
-       memset(&http_client_set, 0, sizeof(http_client_set));
+       i_zero(&http_client_set);
        http_client_set.max_idle_time_msecs = 5*1000;
        http_client_set.max_parallel_connections = 40;
        http_client_set.max_pipelined_requests = 8;
@@ -1556,7 +1556,7 @@ int main(int argc, char *argv[])
   }
 
        /* listen on localhost */
-       memset(&bind_ip, 0, sizeof(bind_ip));
+       i_zero(&bind_ip);
        bind_ip.family = AF_INET;
        bind_ip.u.ip4.s_addr = htonl(INADDR_LOOPBACK);
 
index 4d159d599c63c84b31629ed1044238b634f576b6..96c62f4773039f2ae92e6403f3e5fc220f0f1f85 100644 (file)
@@ -104,7 +104,7 @@ static void test_http_response_parse_valid(void)
                unsigned int pos, response_text_len;
                int ret = 0;
 
-               memset(&response, 0, sizeof(response));
+               i_zero(&response);
                test = &valid_response_parse_tests[i];
                response_text = test->response;
                response_text_len = strlen(response_text);
index 6ce561d1d95c3f5b4eeaf9663d516dc24cd1e22a..6ddd7debea0e601cf42462ee7c5927967dd2adfb 100644 (file)
@@ -541,7 +541,7 @@ static void
 test_server_defaults(struct http_server_settings *http_set)
 {
        /* server settings */
-       memset(http_set, 0, sizeof(*http_set));
+       i_zero(http_set);
        http_set->max_client_idle_time_msecs = 5*1000;
        http_set->max_pipelined_requests = 1;
        http_set->debug = debug;
@@ -746,7 +746,7 @@ int main(int argc, char *argv[])
   }
 
        /* listen on localhost */
-       memset(&bind_ip, 0, sizeof(bind_ip));
+       i_zero(&bind_ip);
        bind_ip.family = AF_INET;
        bind_ip.u.ip4.s_addr = htonl(INADDR_LOOPBACK);  
 
index b134f094b68213b07dc636c105bc410f1f7c43e8..93b42e3b72785f51142695518d40e2d8fa5e1bfb 100644 (file)
@@ -83,7 +83,7 @@ static void client_init(int fd)
        struct client *client;
        struct http_request_limits req_limits;
 
-       memset(&req_limits, 0, sizeof(req_limits));
+       i_zero(&req_limits);
        req_limits.max_target_length = 4096;
 
        client = i_new(struct client, 1);
index 46bc38d19692abde37fca52f7c5e86647b79776c..06273379f71f2bc96aaa45b54ee4afb624286f74 100644 (file)
@@ -86,7 +86,7 @@ imapc_client_init(const struct imapc_client_settings *set)
                client->set.ssl_ca_file = p_strdup(pool, set->ssl_ca_file);
                client->set.ssl_verify = set->ssl_verify;
 
-               memset(&ssl_set, 0, sizeof(ssl_set));
+               i_zero(&ssl_set);
                ssl_set.ca_dir = set->ssl_ca_dir;
                ssl_set.ca_file = set->ssl_ca_file;
                ssl_set.verify_remote_cert = set->ssl_verify;
index f308c1ceca63413738ef0a7a6d8c7c48901d368f..93f86cebf86718c08d32d1eec26e00fe95f75be2 100644 (file)
@@ -290,7 +290,7 @@ void imapc_connection_abort_commands(struct imapc_connection *conn,
 
        /* abort the commands. we'll do it here later so that if the
           callback recurses us back here we don't crash */
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        reply.state = IMAPC_COMMAND_STATE_DISCONNECTED;
        reply.text_without_resp = reply.text_full =
                "Disconnected from server";
@@ -328,7 +328,7 @@ static void imapc_connection_set_state(struct imapc_connection *conn,
 
        switch (state) {
        case IMAPC_CONNECTION_STATE_DISCONNECTED:
-               memset(&reply, 0, sizeof(reply));
+               i_zero(&reply);
                reply.state = IMAPC_COMMAND_STATE_DISCONNECTED;
                reply.text_full = "Disconnected from server";
                if (conn->disconnect_reason != NULL) {
@@ -372,7 +372,7 @@ imapc_connection_literal_reset(struct imapc_connection_literal *literal)
        }
        i_free_and_null(literal->temp_path);
 
-       memset(literal, 0, sizeof(*literal));
+       i_zero(literal);
        literal->fd = -1;
 }
 
@@ -939,7 +939,7 @@ static void imapc_connection_authenticate(struct imapc_connection *conn)
                return;
        }
 
-       memset(&sasl_set, 0, sizeof(sasl_set));
+       i_zero(&sasl_set);
        if (set->master_user == NULL)
                sasl_set.authid = set->username;
        else {
@@ -1120,7 +1120,7 @@ static int imapc_connection_input_untagged(struct imapc_connection *conn)
                }
                imap_args++;
        }
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
 
        if (strcasecmp(name, "OK") == 0) {
                if (imapc_connection_handle_imap_resp_text(conn, imap_args,
@@ -1183,7 +1183,7 @@ static int imapc_connection_input_plus(struct imapc_connection *conn)
                        /* continue AUTHENTICATE */
                        struct imapc_command_reply reply;
 
-                       memset(&reply, 0, sizeof(reply));
+                       i_zero(&reply);
                        reply.state = (enum imapc_command_state)IMAPC_COMMAND_STATE_AUTHENTICATE_CONTINUE;
                        reply.text_full = line;
                        cmds[0]->callback(&reply, cmds[0]->context);
@@ -1285,7 +1285,7 @@ static int imapc_connection_input_tagged(struct imapc_connection *conn)
        /* make sure reply texts stays valid if input stream gets freed */
        line = t_strdup_noconst(line);
 
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
 
        linep = strchr(line, ' ');
        if (linep == NULL)
@@ -1514,7 +1514,7 @@ static int imapc_connection_ssl_init(struct imapc_connection *conn)
                return -1;
        }
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        if (conn->client->set.ssl_verify) {
                ssl_set.verbose_invalid_cert = TRUE;
                ssl_set.verify_remote_cert = TRUE;
@@ -1744,7 +1744,7 @@ void imapc_connection_connect(struct imapc_connection *conn,
                        (long)conn->last_connect);
        }
 
-       memset(&dns_set, 0, sizeof(dns_set));
+       i_zero(&dns_set);
        dns_set.dns_client_socket_path =
                conn->client->set.dns_client_socket_path;
        dns_set.timeout_msecs = conn->client->set.connect_timeout_msecs;
@@ -2041,7 +2041,7 @@ static void imapc_command_send_more(struct imapc_connection *conn)
                        return;
                }
                /* shouldn't normally happen */
-               memset(&reply, 0, sizeof(reply));
+               i_zero(&reply);
                reply.text_without_resp = reply.text_full = "Mailbox not open";
                reply.state = IMAPC_COMMAND_STATE_DISCONNECTED;
 
@@ -2062,7 +2062,7 @@ static void imapc_command_send_more(struct imapc_connection *conn)
        if ((ret = imapc_command_try_send_stream(conn, cmd)) == 0)
                return;
        if (ret == -1) {
-               memset(&reply, 0, sizeof(reply));
+               i_zero(&reply);
                reply.text_without_resp = reply.text_full = "Mailbox not open";
                reply.state = IMAPC_COMMAND_STATE_DISCONNECTED;
 
index 536c1cae8158187091e47914c72e75b3fae404c5..272bb5f297f6ea61fa5fe4d37b3db612efbe5bde 100644 (file)
@@ -149,7 +149,7 @@ int imap_metadata_unset(struct imap_metadata_transaction *imtrans,
 {
        struct mail_attribute_value value;
 
-       memset(&value, 0, sizeof(value));
+       i_zero(&value);
        return imap_metadata_set(imtrans, entry, &value);
 }
 
@@ -159,7 +159,7 @@ int imap_metadata_get(struct imap_metadata_transaction *imtrans,
        enum mail_attribute_type type;
        const char *key;
 
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
        if (!imap_metadata_entry2key(imtrans, entry, &type, &key))
                return 0;
        return mailbox_attribute_get(imtrans->box, type, key, value_r);
@@ -171,7 +171,7 @@ int imap_metadata_get_stream(struct imap_metadata_transaction *imtrans,
        enum mail_attribute_type type;
        const char *key;
 
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
        if (!imap_metadata_entry2key(imtrans, entry, &type, &key))
                return 0;
        return mailbox_attribute_get_stream(imtrans->box, type, key, value_r);
index 9d2ccf4e44553ebef5a2503ad378b4dac754cc58..9a85c33f6792b730af22bb2b0976b1ce821cf681 100644 (file)
@@ -74,7 +74,7 @@ int imap_msgpart_url_parse(struct mail_user *user, struct mailbox *selected_box,
        const char  *error;
 
        /* build base url */
-       memset(&base_url, 0, sizeof(base_url));
+       i_zero(&base_url);
        if (selected_box != NULL) {
                mailbox_get_open_status(selected_box, STATUS_UIDVALIDITY,
                                        &box_status);
index 83ec25822716934270a98aaa656b16bf9f056e23..c85be662e233c2c9761660a9c1b07c6d533da286 100644 (file)
@@ -573,9 +573,9 @@ imap_msgpart_open_normal(struct mail *mail, struct imap_msgpart *msgpart,
        struct istream *input = NULL;
        bool unknown_crlfs = FALSE;
 
-       memset(&hdr_size, 0, sizeof(hdr_size));
-       memset(&body_size, 0, sizeof(body_size));
-       memset(&part_size, 0, sizeof(part_size));
+       i_zero(&hdr_size);
+       i_zero(&body_size);
+       i_zero(&part_size);
 
        if (*msgpart->section_number != '\0') {
                /* find the MIME part */
@@ -674,7 +674,7 @@ int imap_msgpart_open(struct mail *mail, struct imap_msgpart *msgpart,
        bool include_hdr, binary, use_partial_cache, have_crlfs;
        int ret;
 
-       memset(result_r, 0, sizeof(*result_r));
+       i_zero(result_r);
 
        if ((ret = imap_msgpart_find_part(mail, msgpart, &part)) < 0)
                return -1;
index c847e6d2fe7f48d28086b9ea24ad7543fa1d2bd0..f3a23c36096d212d90cf188544a253d7043ed7c1 100644 (file)
@@ -34,7 +34,7 @@ imap_urlauth_backend_trans_set_mailbox_key(struct mailbox *box,
        random_fill(mailbox_key_r, IMAP_URLAUTH_KEY_LEN);
        mailbox_key_hex = binary_to_hex(mailbox_key_r,
                                        IMAP_URLAUTH_KEY_LEN);
-       memset(&urlauth_key, 0, sizeof(urlauth_key));
+       i_zero(&urlauth_key);
        urlauth_key.value = mailbox_key_hex;
        ret = mailbox_attribute_set(t, MAIL_ATTRIBUTE_TYPE_PRIVATE,
                                    IMAP_URLAUTH_KEY, &urlauth_key);
index c8544b72735a07ba236267b5759b16a6054578cf..bb8330fd016823789d00671d98dfcc7dd7efdd8d 100644 (file)
@@ -360,7 +360,7 @@ imap_urlauth_request_fail(struct imap_urlauth_connection *conn,
        callback = urlreq->callback;
        urlreq->callback = NULL;
        if (callback != NULL) {
-               memset(&reply, 0, sizeof(reply));
+               i_zero(&reply);
                reply.url = urlreq->url;
                reply.flags = urlreq->flags;
                reply.succeeded = FALSE;
@@ -648,7 +648,7 @@ imap_urlauth_connection_read_literal(struct imap_urlauth_connection *conn)
        i_assert(conn->literal_bytes_left == 0);
 
        /* reply */
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        reply.url = urlreq->url;
        reply.flags = urlreq->flags;
        reply.bodypartstruct = urlreq->bodypartstruct;
index 736be82c17d2fefba66e6b718480314459776f04..c5fa27db5ae35cbe91ed08c6464d79b2f3902792 100644 (file)
@@ -150,7 +150,7 @@ imap_urlauth_fetch_error(struct imap_urlauth_fetch *ufetch, const char *url,
 
        ufetch->pending_requests--;
 
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        reply.url = url;
        reply.flags = url_flags;
        reply.succeeded = FALSE;
@@ -226,7 +226,7 @@ imap_urlauth_fetch_local(struct imap_urlauth_fetch *ufetch, const char *url,
        }
 
        /* if requested, read the message part the URL points to */
-       memset(&mpresult, 0, sizeof(mpresult));
+       i_zero(&mpresult);
        if (success && ((url_flags & IMAP_URLAUTH_FETCH_FLAG_BODY) != 0 ||
                        (url_flags & IMAP_URLAUTH_FETCH_FLAG_BINARY) != 0)) {
                ret = imap_msgpart_url_read_part(mpurl, &mpresult, &error);
@@ -263,7 +263,7 @@ imap_urlauth_fetch_local(struct imap_urlauth_fetch *ufetch, const char *url,
                return;
        }
 
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        reply.url = url;
        reply.flags = url_flags;
        reply.error = errormsg;
@@ -459,7 +459,7 @@ static bool imap_urlauth_fetch_do_continue(struct imap_urlauth_fetch *ufetch)
 
                ufetch->pending_requests--;
 
-               memset(&reply, 0, sizeof(reply));
+               i_zero(&reply);
                reply.url = ufetch->pending_reply.url;
                reply.flags = ufetch->pending_reply.flags;
                reply.bodypartstruct = ufetch->pending_reply.bodypartstruct;
index 857209f5e23b502d544a6b5e8d444e077d6df188..8cec4c6a88f272a068a61fde42c5788bbfe47c5b 100644 (file)
@@ -250,7 +250,7 @@ void imap_bodystructure_parse_header(pool_t pool, struct message_part *part,
                        part_data = part->context;
                        envelope = part_data->envelope;
 
-                       memset(part_data, 0, sizeof(*part_data));
+                       i_zero(part_data);
                        part_data->pool = pool;
                        part_data->envelope = envelope;
                }
index 43577270ba85e5a7134d887c3f57ba76ebea46ca..fe47e42c4f5cf04d124f6a9fc55a02a27e06d2b0 100644 (file)
@@ -34,7 +34,7 @@ static const char *imap_parse_date_internal(const char *str, struct tm *tm)
        if (str == NULL || *str == '\0')
                return NULL;
 
-       memset(tm, 0, sizeof(*tm));
+       i_zero(tm);
 
        /* "dd-mon-yyyy [hh:mi:ss +|-zone]"
           dd is 1-2 digits and may be prefixed with space or zero. */
index e00b8921d48b2a1818c2a0a90d094e4c76e54a6c..cef4f1b535f7485a481a502ea91afd6267b23ec6 100644 (file)
@@ -22,7 +22,7 @@ static const char *imap_id_get_uname(const char *key)
                utsname_set = TRUE;
                if (uname(&utsname_result) < 0) {
                        i_error("uname() failed: %m");
-                       memset(&utsname_result, 0, sizeof(utsname_result));
+                       i_zero(&utsname_result);
                }
        }
 
index fcffc08221c76295b064737a03c5217fcd678b51..99ab44a7c51b24cd5407f43d3a6266b13c39c8ea 100644 (file)
@@ -900,7 +900,7 @@ int imap_url_parse(const char *url, const struct imap_url *base,
        i_assert((flags & IMAP_URL_PARSE_REQUIRE_RELATIVE) == 0 || base != NULL);
        i_assert((flags & IMAP_URL_PARSE_SCHEME_EXTERNAL) == 0 || base == NULL);
 
-       memset(&url_parser, 0, sizeof(url_parser));
+       i_zero(&url_parser);
        uri_parser_init(&url_parser.parser, pool_datastack_create(), url);
 
        url_parser.url = t_new(struct imap_url, 1);
index 35819c734b4e78ce53aa3ac7e07ed382256f530e..6279fe904a9be5c76b349013a1c18b9578947aaf 100644 (file)
@@ -187,7 +187,7 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_transaction *trans,
        cache_view = mail_cache_view_open(cache, view);
        output = o_stream_create_fd_file(fd, 0, FALSE);
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.major_version = MAIL_CACHE_MAJOR_VERSION;
        hdr.minor_version = MAIL_CACHE_MINOR_VERSION;
        hdr.compat_sizeof_uoff_t = sizeof(uoff_t);
@@ -195,7 +195,7 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_transaction *trans,
        hdr.file_seq = get_next_file_seq(cache);
        o_stream_nsend(output, &hdr, sizeof(hdr));
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.cache = cache;
        ctx.buffer = buffer_create_dynamic(default_pool, 4096);
        ctx.field_seen = buffer_create_dynamic(default_pool, 64);
@@ -264,7 +264,7 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_transaction *trans,
                        ctx.field_seen_value++;
                }
 
-               memset(&cache_rec, 0, sizeof(cache_rec));
+               i_zero(&cache_rec);
                buffer_append(ctx.buffer, &cache_rec, sizeof(cache_rec));
 
                mail_cache_lookup_iter_init(cache_view, seq, &iter);
index a46a2e400ea9df0a3c9f3c9ab71b8c0aa856b39c..57a8cdd8d060866f7bc51ac6d8fe00a7778d1326 100644 (file)
@@ -377,7 +377,7 @@ int mail_cache_header_fields_read(struct mail_cache *cache)
        max_drop_time = cache->index->map->hdr.day_stamp == 0 ? 0 :
                cache->index->map->hdr.day_stamp - MAIL_CACHE_FIELD_DROP_SECS;
 
-       memset(&field, 0, sizeof(field));
+       i_zero(&field);
        for (i = 0; i < field_hdr->fields_count; i++) {
                for (p = names; p != end && *p != '\0'; p++) ;
                if (p == end || *names == '\0') {
@@ -561,7 +561,7 @@ void mail_cache_header_fields_get(struct mail_cache *cache, buffer_t *dest)
        const char *name;
        uint32_t i;
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.fields_count = cache->file_fields_count;
        for (i = 0; i < cache->fields_count; i++) {
                if (CACHE_FIELD_IS_NEWLY_WANTED(cache, i))
index 68bb126b7ef6f93c1b3377d571ce5e6d8af8d89c..b553d5545dbdfd69915113b1c2f7a84db90c8e27 100644 (file)
@@ -144,7 +144,7 @@ void mail_cache_lookup_iter_init(struct mail_cache_view *view, uint32_t seq,
        if (!view->cache->opened)
                (void)mail_cache_open_and_verify(view->cache);
 
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ctx->view = view;
        ctx->seq = seq;
 
@@ -159,7 +159,7 @@ void mail_cache_lookup_iter_init(struct mail_cache_view *view, uint32_t seq,
        }
        ctx->remap_counter = view->cache->remap_counter;
 
-       memset(&view->loop_track, 0, sizeof(view->loop_track));
+       i_zero(&view->loop_track);
 }
 
 static bool
@@ -210,7 +210,7 @@ mail_cache_lookup_iter_next_record(struct mail_cache_lookup_iterate_ctx *ctx)
 
                ctx->disk_appends_checked = TRUE;
                ctx->remap_counter = view->cache->remap_counter;
-               memset(&view->loop_track, 0, sizeof(view->loop_track));
+               i_zero(&view->loop_track);
        }
 
        if (ctx->stop)
@@ -541,7 +541,7 @@ mail_cache_lookup_headers_real(struct mail_cache_view *view, string_t *dest,
        field_state = buffer_get_modifiable_data(buf, NULL);
 
        /* lookup the fields */
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.view = view;
        ctx.pool = *pool_r = pool_alloconly_create(MEMPOOL_GROWING"mail cache headers", 1024);
        t_array_init(&ctx.lines, 32);
index b874ef1e023860c12fa700b630bfff8d9c2166e5..ec4d2a7d9c194e5db58dfd48e436be7cb062d9d4 100644 (file)
@@ -514,7 +514,7 @@ mail_cache_transaction_switch_seq(struct mail_cache_transaction_ctx *ctx)
                i_array_init(&ctx->cache_data_seq, 64);
        }
 
-       memset(&new_rec, 0, sizeof(new_rec));
+       i_zero(&new_rec);
        buffer_append(ctx->cache_data, &new_rec, sizeof(new_rec));
 
        ctx->prev_seq = 0;
index 8bdc54933f650007891bf227c58799c4056c139b..cc2eebb54fbd5d67aa02b3a4cc9ac161201961f6 100644 (file)
@@ -143,7 +143,7 @@ mail_index_alloc_cache_get(const char *mailbox_path,
        /* compare index_dir inodes so we don't break even with symlinks.
           if index_dir doesn't exist yet or if using in-memory indexes, just
           compare mailbox paths */
-       memset(&st, 0, sizeof(st));
+       i_zero(&st);
        if (index_dir == NULL) {
                /* in-memory indexes */
        } else if (stat(index_dir, &st) < 0) {
index 14afd4828ef4098eb546f30267a6f35f97bbc73b..1b2dc36224a8cd841bd617cd9889928d278e4fcc 100644 (file)
@@ -222,7 +222,7 @@ mail_index_fsck_keywords(struct mail_index *index, struct mail_index_map *map,
 
        /* add keyword records so we can start appending names directly */
        rec_pos = dest->used;
-       memset(&new_kw_rec, 0, sizeof(new_kw_rec));
+       i_zero(&new_kw_rec);
        (void)buffer_append_space_unsafe(dest, keywords_count * sizeof(*kw_rec));
 
        /* write the actual records and names */
index c9b7f8b31f68f78d3f35adf46cac30a2cb2d757b..189b7bc1f2ff68d412ef8431b5c14d9c39974d99 100644 (file)
@@ -16,7 +16,7 @@ static void mail_index_map_copy_hdr(struct mail_index_map *map,
        if (hdr->base_header_size < sizeof(map->hdr)) {
                /* header smaller than ours, make a copy so our newer headers
                   won't have garbage in them */
-               memset(&map->hdr, 0, sizeof(map->hdr));
+               i_zero(&map->hdr);
                memcpy(&map->hdr, hdr, hdr->base_header_size);
        } else {
                map->hdr = *hdr;
index 061c063154cb244aa4aea62f58d98072ae7542f5..ead9fbdf739c4e0fdb3b64b1c736f8a492a37dac 100644 (file)
@@ -231,7 +231,7 @@ static void mail_index_header_init(struct mail_index *index,
 {
        i_assert((sizeof(*hdr) % sizeof(uint64_t)) == 0);
 
-       memset(hdr, 0, sizeof(*hdr));
+       i_zero(hdr);
 
        hdr->major_version = MAIL_INDEX_MAJOR_VERSION;
        hdr->minor_version = MAIL_INDEX_MINOR_VERSION;
@@ -253,7 +253,7 @@ struct mail_index_map *mail_index_map_alloc(struct mail_index *index)
 {
        struct mail_index_map tmp_map;
 
-       memset(&tmp_map, 0, sizeof(tmp_map));
+       i_zero(&tmp_map);
        mail_index_header_init(index, &tmp_map.hdr);
        tmp_map.index = index;
        tmp_map.hdr_base = &tmp_map.hdr;
index 8a987a3728927bb5b1b15a1a4e20a01c1a47cf74..be5a4652df373a3a314dcbdb3a5c08381f5efb9b 100644 (file)
@@ -68,7 +68,7 @@ void mail_index_modseq_enable(struct mail_index *index)
                view = mail_index_view_open(index);
                trans = mail_index_transaction_begin(view, 0);
 
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
                hdr.highest_modseq = mail_index_modseq_get_head(index);
                mail_index_update_header_ext(trans, index->modseq_ext_id,
                                             0, &hdr, sizeof(hdr));
@@ -513,7 +513,7 @@ static void mail_index_modseq_update_header(struct mail_index_view *view,
        if (old_modseq_hdr->log_seq < log_seq ||
            (old_modseq_hdr->log_seq == log_seq &&
             old_modseq_hdr->log_offset < log_offset)) {
-               memset(&new_modseq_hdr, 0, sizeof(new_modseq_hdr));
+               i_zero(&new_modseq_hdr);
                new_modseq_hdr.highest_modseq = highest_modseq;
                new_modseq_hdr.log_seq = log_seq;
                new_modseq_hdr.log_offset = log_offset;
index 672aba9ee13fc003db117bec84957ae4382b01e0..65fee159e98c764b3650ed0f0fc728159d9dfc2a 100644 (file)
@@ -507,7 +507,7 @@ strmap_read_block_init(struct mail_index_strmap_view *view,
                return 0;
        }
 
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ret = i_stream_read_bytes(strmap->input, &data, &size,
                                  sizeof(block_size));
        if (ret <= 0) {
@@ -656,7 +656,7 @@ strmap_view_sync_block_check_conflicts(struct mail_index_strmap_read_context *ct
 
        if we detect such a conflict, we can't continue using the
        strmap index until X has been expunged. */
-       memset(&iter, 0, sizeof(iter));
+       i_zero(&iter);
        while ((hash_rec = hash2_iterate(ctx->view->hash,
                                         crc32, &iter)) != NULL &&
               hash_rec->str_idx != ctx->rec.str_idx) {
@@ -798,7 +798,7 @@ void mail_index_strmap_view_sync_add_unique(struct mail_index_strmap_view_sync *
                 (uid == view->last_added_uid &&
                  ref_index > view->last_ref_index));
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.uid = uid;
        rec.ref_index = ref_index;
        rec.str_idx = view->next_str_idx++;
@@ -825,7 +825,7 @@ static void mail_index_strmap_view_renumber(struct mail_index_strmap_view *view)
        unsigned int i, dest, count, count2;
        int ret;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.view = view;
        ctx.uid_lookup_seq = 1;
 
@@ -976,7 +976,7 @@ mail_index_strmap_recreate_write(struct mail_index_strmap_view *view,
        idx_hdr = mail_index_get_header(view->view);
 
        /* write header */
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.version = MAIL_INDEX_STRMAP_VERSION;
        hdr.uid_validity = idx_hdr->uid_validity;
        o_stream_nsend(output, &hdr, sizeof(hdr));
index e097979df5029d7ebeacce7cd25a43951c0634c7..741de845a617f06aed4c2326af35ea9c98ec2f1f 100644 (file)
@@ -23,7 +23,7 @@ void mail_index_sync_init_expunge_handlers(struct mail_index_sync_map_ctx *ctx)
        if (!array_is_created(&ctx->view->map->extensions))
                return;
 
-       memset(&eh, 0, sizeof(eh));
+       i_zero(&eh);
        if (array_is_created(&ctx->expunge_handlers))
                array_clear(&ctx->expunge_handlers);
        else
@@ -449,13 +449,13 @@ void mail_index_sync_ext_init(struct mail_index_sync_map_ctx *ctx,
                        return;
 
                /* make sure it's the expected size */
-               memset(&u, 0, sizeof(u));
+               i_zero(&u);
                u.hdr_size = rext->hdr_size;
                u.record_size = rext->record_size;
                u.record_align = rext->record_align;
                sync_ext_resize(&u, *ext_map_idx_r, ctx, FALSE);
        } else {
-               memset(&ext_hdr, 0, sizeof(ext_hdr));
+               i_zero(&ext_hdr);
                ext_hdr.name_size = strlen(name);
                ext_hdr.hdr_size = rext->hdr_size;
                ext_hdr.record_size = rext->record_size;
@@ -523,7 +523,7 @@ int mail_index_sync_ext_intro(struct mail_index_sync_map_ctx *ctx,
                return -1;
        }
 
-       memset(&ext_hdr, 0, sizeof(ext_hdr));
+       i_zero(&ext_hdr);
        ext_hdr.name_size = strlen(name);
        ext_hdr.reset_id = u->reset_id;
        ext_hdr.hdr_size = u->hdr_size;
index d7f6c0675b04dc8d39052a6835deb97d5a98d2f1..1f40d8e0a3634f267bdea5ee11c50b4e28ccd669 100644 (file)
@@ -155,7 +155,7 @@ keywords_header_add(struct mail_index_sync_map_ctx *ctx,
        }
 
        /* add the keyword */
-       memset(&kw_rec, 0, sizeof(kw_rec));
+       i_zero(&kw_rec);
        kw_rec.name_offset = name_offset;
 
        keyword_len = strlen(keyword_name) + 1;
index 5ef40df65a76190dbe052483142028b4cbd0d33c..1f8fac68e7f6dc9b2c6bd1640af2faf84edcabec 100644 (file)
@@ -653,7 +653,7 @@ mail_index_sync_record_real(struct mail_index_sync_map_ctx *ctx,
                        ret = -1;
                        break;
                }
-               memset(&rec, 0, sizeof(rec));
+               i_zero(&rec);
                memcpy(&rec, data, I_MIN(hdr->size, sizeof(rec)));
                ret = mail_index_sync_ext_reset(ctx, &rec);
                break;
@@ -831,7 +831,7 @@ void mail_index_sync_map_init(struct mail_index_sync_map_ctx *sync_map_ctx,
                              struct mail_index_view *view,
                              enum mail_index_sync_handler_type type)
 {
-       memset(sync_map_ctx, 0, sizeof(*sync_map_ctx));
+       i_zero(sync_map_ctx);
        sync_map_ctx->view = view;
        sync_map_ctx->cur_ext_map_idx = (uint32_t)-1;
        sync_map_ctx->type = type;
index 78bace9a6b02e16ff3d605d1dbf58dc3cbb14f78..8f2efbaeba6990fcc339f83feebe388dbb8732da 100644 (file)
@@ -152,7 +152,7 @@ static void mail_index_sync_add_dirty_updates(struct mail_index_sync_ctx *ctx)
        const struct mail_index_record *rec;
        uint32_t seq, messages_count;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
 
        messages_count = mail_index_view_get_messages_count(ctx->view);
        for (seq = 1; seq <= messages_count; seq++) {
index aca1b272c0233e64ce08ed5b98480af67a812aa2..ccc26f2fe4b665fec0a2ef241a58ad8af9bdbd85 100644 (file)
@@ -57,7 +57,7 @@ log_get_hdr_update_buffer(struct mail_index_transaction *t, bool prepend)
        uint16_t offset;
        int state = 0;
 
-       memset(&u, 0, sizeof(u));
+       i_zero(&u);
 
        data = prepend ? t->pre_hdr_change : t->post_hdr_change;
        mask = prepend ? t->pre_hdr_mask : t->post_hdr_mask;
@@ -200,8 +200,8 @@ log_append_ext_hdr_update(struct mail_index_export_context *ctx,
        size_t offset;
        bool started = FALSE, use_32 = hdr->alloc_size >= 65536;
 
-       memset(&u, 0, sizeof(u));
-       memset(&u32, 0, sizeof(u32));
+       i_zero(&u);
+       i_zero(&u32);
 
        data = hdr->data;
        mask = hdr->mask;
@@ -283,7 +283,7 @@ mail_transaction_log_append_ext_intros(struct mail_index_export_context *ctx)
                        ext_count = hdrs_count;
        }
 
-       memset(&ext_reset, 0, sizeof(ext_reset));
+       i_zero(&ext_reset);
        buffer_create_from_data(&reset_buf, &ext_reset, sizeof(ext_reset));
        buffer_set_used_size(&reset_buf, sizeof(ext_reset));
 
@@ -361,7 +361,7 @@ log_append_keyword_update(struct mail_index_export_context *ctx,
 
        i_assert(uid_buffer->used > 0);
 
-       memset(&kt_hdr, 0, sizeof(kt_hdr));
+       i_zero(&kt_hdr);
        kt_hdr.modify_type = modify_type;
        kt_hdr.name_size = strlen(keyword);
 
@@ -417,7 +417,7 @@ void mail_index_transaction_export(struct mail_index_transaction *t,
        enum mail_index_fsync_mask change_mask = 0;
        struct mail_index_export_context ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.trans = t;
        ctx.append_ctx = append_ctx;
 
index 6e9becc2b90ee4cb9e8d2f00c48706b3d2bf8954..d4f717e3779b7b71001341ea997b25c44032a620 100644 (file)
@@ -592,7 +592,7 @@ void mail_index_update_flags_range(struct mail_index_transaction *t,
        if ((t->flags & MAIL_INDEX_TRANSACTION_FLAG_AVOID_FLAG_UPDATES) != 0)
                t->drop_unnecessary_flag_updates = TRUE;
 
-       memset(&u, 0, sizeof(u));
+       i_zero(&u);
        u.uid1 = seq1;
        u.uid2 = seq2;
 
@@ -740,7 +740,7 @@ mail_index_ext_rec_updates_resize(struct mail_index_transaction *t,
                return;
 
        old_array = *array;
-       memset(array, 0, sizeof(*array));
+       i_zero(array);
        mail_index_seq_array_alloc(array, new_record_size);
 
        /* copy the records' beginnings. leave the end zero-filled. */
@@ -763,7 +763,7 @@ void mail_index_ext_resize(struct mail_index_transaction *t, uint32_t ext_id,
        struct mail_transaction_ext_intro intro;
        uint32_t old_record_size = 0, old_record_align, old_header_size;
 
-       memset(&intro, 0, sizeof(intro));
+       i_zero(&intro);
        rext = array_idx(&t->view->index->extensions, ext_id);
 
        /* get ext_id from transaction's map if it's there */
@@ -837,7 +837,7 @@ void mail_index_ext_reset(struct mail_index_transaction *t, uint32_t ext_id,
 
        i_assert(reset_id != 0);
 
-       memset(&reset, 0, sizeof(reset));
+       i_zero(&reset);
        reset.new_reset_id = reset_id;
        reset.preserve_data = clear_data ? 0 : 1;
 
index 54736d5f0d5342ce13aabcb3371d2a8db481a0f7..c81d769cf876df8d0eb09443d2d876cf7ea10459 100644 (file)
@@ -419,7 +419,7 @@ tview_lookup_ext_update(struct mail_index_view_transaction *tview, uint32_t seq,
                        array_idx(&tview->view.index->extensions, ext_id);
                struct mail_index_ext_header ext_hdr;
 
-               memset(&ext_hdr, 0, sizeof(ext_hdr));
+               i_zero(&ext_hdr);
                ext_hdr.hdr_size = rext->hdr_size;
                ext_hdr.record_size = ext_buf->arr.element_size - sizeof(uint32_t);
                ext_hdr.record_align = rext->record_align;
index 492615bbdde2b42abf96b3145f424aa8c2e16c3d..6b7c680e9c88e97d6e9b8c108cce5db97e2e19e0 100644 (file)
@@ -266,7 +266,7 @@ int mail_index_transaction_commit_full(struct mail_index_transaction **_t,
        }
 
        *_t = NULL;
-       memset(result_r, 0, sizeof(*result_r));
+       i_zero(result_r);
        if (t->v.commit(t, result_r) < 0)
                return -1;
 
index 01d5bb04a20eea988f97777812e40bb7be318cf4..12cf701771cb6cb4743605043eed3e4871084db5 100644 (file)
@@ -293,9 +293,9 @@ static int view_sync_update_keywords(struct mail_index_view_sync_ctx *ctx,
                return 0;
        kw_names = array_idx(&ctx->view->index->keywords, 0);
 
-       memset(&thdr, 0, sizeof(thdr));
+       i_zero(&thdr);
        thdr.type = MAIL_TRANSACTION_KEYWORD_UPDATE | MAIL_TRANSACTION_EXTERNAL;
-       memset(&kw_up, 0, sizeof(kw_up));
+       i_zero(&kw_up);
        kw_up.modify_type = MODIFY_ADD;
        /* add new flags one by one */
        for (i = 0; i < count; i++) {
@@ -334,7 +334,7 @@ static int view_sync_apply_lost_changes(struct mail_index_view_sync_ctx *ctx,
        old_rec = MAIL_INDEX_REC_AT_SEQ(old_map, old_seq);
        new_rec = MAIL_INDEX_REC_AT_SEQ(new_map, new_seq);
 
-       memset(&thdr, 0, sizeof(thdr));
+       i_zero(&thdr);
        if (old_rec->flags != new_rec->flags) {
                struct mail_transaction_flag_update flag_update;
 
@@ -348,7 +348,7 @@ static int view_sync_apply_lost_changes(struct mail_index_view_sync_ctx *ctx,
                        MAIL_TRANSACTION_EXTERNAL;
                thdr.size = sizeof(flag_update);
 
-               memset(&flag_update, 0, sizeof(flag_update));
+               i_zero(&flag_update);
                flag_update.uid1 = flag_update.uid2 = new_rec->uid;
                flag_update.add_flags = new_rec->flags;
                flag_update.remove_flags = ~new_rec->flags & 0xff;
@@ -367,7 +367,7 @@ static int view_sync_apply_lost_changes(struct mail_index_view_sync_ctx *ctx,
                thdr.size = sizeof(kw_reset);
 
                /* remove all old flags by resetting them */
-               memset(&kw_reset, 0, sizeof(kw_reset));
+               i_zero(&kw_reset);
                kw_reset.uid1 = kw_reset.uid2 = new_rec->uid;
                if (mail_index_sync_record(&ctx->sync_map_ctx, &thdr,
                                           &kw_reset) < 0)
index 45ea3ecc867da479a101b82ef084ba84c6857af1..7af3cebb57ae4ad051d970a74774981985e29733 100644 (file)
@@ -25,7 +25,7 @@ mail_index_view_dup_private(const struct mail_index_view *src)
 void mail_index_view_clone(struct mail_index_view *dest,
                           const struct mail_index_view *src)
 {
-       memset(dest, 0, sizeof(*dest));
+       i_zero(dest);
        dest->refcount = 1;
        dest->v = src->v;
        dest->index = src->index;
index 58a45aff8daa0249639e2b4825057d1c15cb3647..3b22c6dc9769353969ca587bf1ad292e910875f7 100644 (file)
@@ -169,7 +169,7 @@ uint32_t mail_index_ext_register(struct mail_index *index, const char *name,
        if (mail_index_ext_lookup(index, name, &ext_id))
                return ext_id;
 
-       memset(&rext, 0, sizeof(rext));
+       i_zero(&rext);
        rext.name = p_strdup(index->extension_pool, name);
        rext.index_idx = array_count(&index->extensions);
        rext.hdr_size = default_hdr_size;
index 9fd4c1387cec3712622a815a5d40b37f1e78fe6b..5389ae0c8dde4b91b07e755a7be1af5669ab4c3c 100644 (file)
@@ -18,7 +18,7 @@ void mail_transaction_log_append_add(struct mail_transaction_log_append_ctx *ctx
        if (size == 0)
                return;
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.type = type | ctx->trans_flags;
        if (type == MAIL_TRANSACTION_EXPUNGE ||
            type == MAIL_TRANSACTION_EXPUNGE_GUID)
@@ -229,7 +229,7 @@ int mail_transaction_log_append_begin(struct mail_index *index,
        ctx->output = buffer_create_dynamic(default_pool, 1024);
        ctx->trans_flags = flags;
 
-       memset(&boundary, 0, sizeof(boundary));
+       i_zero(&boundary);
        mail_transaction_log_append_add(ctx, MAIL_TRANSACTION_BOUNDARY,
                                        &boundary, sizeof(boundary));
 
index 410cf59218cf44e706c49a36fc00bf2e00fe4919..eca1207c64ab8c16ce721bbbf48d8b86b489078c 100644 (file)
@@ -224,7 +224,7 @@ mail_transaction_log_init_hdr(struct mail_transaction_log *log,
 
        i_assert(index->indexid != 0);
 
-       memset(hdr, 0, sizeof(*hdr));
+       i_zero(hdr);
        hdr->major_version = MAIL_TRANSACTION_LOG_MAJOR_VERSION;
        hdr->minor_version = MAIL_TRANSACTION_LOG_MINOR_VERSION;
        hdr->hdr_size = sizeof(struct mail_transaction_log_header);
@@ -441,7 +441,7 @@ mail_transaction_log_file_read_header(struct mail_transaction_log_file *file)
 
        i_assert(file->buffer == NULL && file->mmap_base == NULL);
 
-       memset(&file->hdr, 0, sizeof(file->hdr));
+       i_zero(&file->hdr);
        if (file->last_size < mmap_get_page_size() && file->last_size > 0) {
                /* just read the entire transaction log to memory.
                   note that if some of the data hasn't been fully committed
index 39c19523c67c010547aa875fb4f75807012969b2..140b1bb3617dd425d842ce348aae71f181bc34a8 100644 (file)
@@ -605,7 +605,7 @@ void mail_transaction_log_get_dotlock_set(struct mail_transaction_log *log,
 {
        struct mail_index *index = log->index;
 
-       memset(set_r, 0, sizeof(*set_r));
+       i_zero(set_r);
        set_r->timeout = I_MIN(MAIL_TRANSACTION_LOG_LOCK_TIMEOUT,
                               index->max_lock_timeout_secs);
        set_r->stale_timeout = MAIL_TRANSACTION_LOG_LOCK_CHANGE_TIMEOUT;
index 1a1da2c1055083082c5d236c611cbbf7c3d631db..14076e7b39e2b7cea722ee66837d1e77ae0a8350 100644 (file)
@@ -13,8 +13,8 @@ static void test_mail_index_map_lookup_seq_range_count(unsigned int messages_cou
        struct mail_index_map map;
        uint32_t seq, first_uid, last_uid, first_seq, last_seq, max_uid;
 
-       memset(&map, 0, sizeof(map));
-       memset(&rec_map, 0, sizeof(rec_map));
+       i_zero(&map);
+       i_zero(&rec_map);
        map.rec_map = &rec_map;
        map.hdr.messages_count = messages_count;
        map.hdr.record_size = sizeof(struct mail_index_record);
index 69a7cce13cb0949124297f0add227ac52f32ec92..510eb9011b3818bd2741056f96a744abd9cd2983 100644 (file)
@@ -41,7 +41,7 @@ static void test_mail_index_sync_ext_atomic_inc(void)
 
        test_begin("mail index sync ext atomic inc");
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.view = t_new(struct mail_index_view, 1);
        ctx.view->map = t_new(struct mail_index_map, 1);
        ctx.view->map->hdr.next_uid = 2;
@@ -54,7 +54,7 @@ static void test_mail_index_sync_ext_atomic_inc(void)
        ext->record_offset = sizeof(struct mail_index_record);
        ptr = PTR_OFFSET(ctx.view->map->rec_map->records, ext->record_offset);
 
-       memset(&u, 0, sizeof(u));
+       i_zero(&u);
        test_assert(mail_index_sync_ext_atomic_inc(&ctx, &u) == -1);
 
        u.uid = 2;
index a4f016ee0f8f364dee9aedf2bedc890a2b4e218f..f0f611de47b16f8eef5901bd34a99736465ef6aa 100644 (file)
@@ -72,7 +72,7 @@ test_mail_index_transaction_finish_flag_updates(unsigned int n_so_far)
        t = t_new(struct mail_index_transaction, 1);
        t->drop_unnecessary_flag_updates = TRUE;
 
-       memset(&u, 0, sizeof(u));
+       i_zero(&u);
        u.add_flags = MAIL_SEEN; u.remove_flags = MAIL_DRAFT;
 
        test_begin(t_strdup_printf("mail index transaction finish flag updates n_so_far=%u", n_so_far));
index c640ce4b57e4bab3583a38b39287b0c40110062d..3d1018929468e9e499004d53e7b2db18c4d26f26 100644 (file)
@@ -105,7 +105,7 @@ add_append_record(struct mail_transaction_log_file *file,
        struct mail_transaction_header hdr;
        size_t size;
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.type = MAIL_TRANSACTION_APPEND | MAIL_TRANSACTION_EXTERNAL;
        hdr.size = mail_index_uint32_to_offset(sizeof(hdr) + sizeof(*rec));
 
@@ -139,7 +139,7 @@ static void test_mail_transaction_log_view(void)
        test_transaction_log_file_add(3);
 
        /* add an append record to the 3rd log file */
-       memset(&append_rec, 0, sizeof(append_rec));
+       i_zero(&append_rec);
        append_rec.uid = 1;
 
        last_log_size = sizeof(struct mail_transaction_log_header) +
index dcfa9d3aea4345c268ad6bc818ae963a58b38d53..a3248e3f2add3adcf06bc044b369b1b2e3ead04b 100644 (file)
@@ -296,14 +296,14 @@ void duplicate_flush(struct duplicate_context *ctx)
                return;
        }
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.version = DUPLICATE_VERSION;
 
        output = o_stream_create_fd_file(file->new_fd, 0, FALSE);
        o_stream_cork(output);
        o_stream_nsend(output, &hdr, sizeof(hdr));
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        iter = hash_table_iterate_init(file->hash);
        while (hash_table_iterate(iter, file->hash, &d, &d)) {
                rec.stamp = d->time;
index 285ff0f927652f8d09e29d1d0f0feeb0c4a431ae..4aec30a9cd2f61a6e5caeeabd1ab0c6332f80cec 100644 (file)
@@ -730,7 +730,7 @@ int lmtp_client_connect_tcp(struct lmtp_client *client,
                return -1;
        }
 
-       memset(&dns_lookup_set, 0, sizeof(dns_lookup_set));
+       i_zero(&dns_lookup_set);
        dns_lookup_set.dns_client_socket_path =
                client->set.dns_client_socket_path;
        dns_lookup_set.timeout_msecs = LMTP_CLIENT_DNS_LOOKUP_TIMEOUT_MSECS;
@@ -804,7 +804,7 @@ void lmtp_client_add_rcpt(struct lmtp_client *client, const char *address,
 {
        struct lmtp_recipient_params params;
 
-       memset(&params, 0, sizeof(params));
+       i_zero(&params);
        lmtp_client_add_rcpt_params(client, address, &params, rcpt_to_callback,
                                    data_callback, context);
 }
index a57e21d4ca9eb506814459eba1381fc10cb65f91..b003296ea0c18a980dfa88dc41df60ce0403b7e0 100644 (file)
@@ -350,7 +350,7 @@ int mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox,
        if (default_save)
                ctx->tried_default_save = TRUE;
 
-       memset(&open_ctx, 0, sizeof(open_ctx));
+       i_zero(&open_ctx);
        open_ctx.user = ctx->dest_user;
        open_ctx.lda_mailbox_autocreate = ctx->set->lda_mailbox_autocreate;
        open_ctx.lda_mailbox_autosubscribe = ctx->set->lda_mailbox_autosubscribe;
index 7082261a2cea32b377241fb8a0683cdc1e56cc10..f560f2f5807300b95cf4ec3ecc5b302df7a0ae7d 100644 (file)
@@ -135,7 +135,7 @@ smtp_client_send_host(struct smtp_client *client,
                return -1;
        }
 
-       memset(&client_set, 0, sizeof(client_set));
+       i_zero(&client_set);
        client_set.mail_from = client->return_path == NULL ? "<>" :
                t_strconcat("<", client->return_path, ">", NULL);
        client_set.my_hostname = client->set->hostname;
@@ -208,7 +208,7 @@ smtp_client_send_sendmail(struct smtp_client *client,
        array_append_array(&args, &client->destinations);
        array_append_zero(&args);
 
-       memset(&pc_set, 0, sizeof(pc_set));
+       i_zero(&pc_set);
        pc_set.client_connect_timeout_msecs = timeout_secs * 1000;
        pc_set.input_idle_timeout_msecs = timeout_secs * 1000;
        restrict_access_init(&pc_set.restrict_set);
index 0e81c657a56747fab7924663c8a36455581dbbcb..785f61201711881c6e325a5e3c6c8219dba5991a 100644 (file)
@@ -22,7 +22,7 @@ ldap_compare_callback(struct ldap_connection *conn,
        ret = ldap_parse_result(conn->conn, message,
                                &result_err, NULL,
                                &result_errmsg, NULL, NULL, 0);
-       memset(&res, 0, sizeof(res));
+       i_zero(&res);
        res.openldap_ret = ret;
        if (ret != LDAP_SUCCESS) {
                res.error_string = t_strdup_printf(
index f857eab8c6b9944d1bb12b58b44773675a8716a6..bab62495e8d9a842bb61ff965a04f735aa0f2714 100644 (file)
@@ -212,7 +212,7 @@ ldap_connection_result_failure(struct ldap_connection *conn,
                               int ret, const char *error)
 {
        struct ldap_result res;
-       memset(&res, 0, sizeof(res));
+       i_zero(&res);
        res.conn = conn;
        res.openldap_ret = ret;
        res.error_string = error;
@@ -228,7 +228,7 @@ void ldap_connection_result_success(struct ldap_connection *conn,
                                    struct ldap_op_queue_entry *req)
 {
        struct ldap_result res;
-       memset(&res, 0, sizeof(res));
+       i_zero(&res);
        res.conn = conn;
        res.openldap_ret = LDAP_SUCCESS;
        if (req->result_callback != NULL)
@@ -282,7 +282,7 @@ void ldap_connection_send_next(struct ldap_connection *conn)
                /* did not succeed */
                struct ldap_result res;
 
-               memset(&res, 0, sizeof(res));
+               i_zero(&res);
                res.openldap_ret = ret;
                if (req->result_callback != NULL)
                        req->result_callback(&res, req->result_callback_ctx);
@@ -417,7 +417,7 @@ void ldap_connection_abort_request(struct ldap_op_queue_entry *req)
        if (req->msgid > -1)
                ldap_abandon_ext(req->conn->conn, req->msgid, NULL, NULL);
 
-       memset(&res, 0, sizeof(res));
+       i_zero(&res);
        res.openldap_ret = LDAP_TIMEOUT;
        res.error_string = "Aborting LDAP request after timeout";
        if (req->result_callback != NULL)
@@ -441,7 +441,7 @@ static
 void ldap_connection_abort_all_requests(struct ldap_connection *conn)
 {
        struct ldap_result res;
-       memset(&res, 0, sizeof(res));
+       i_zero(&res);
        res.openldap_ret = LDAP_TIMEOUT;
        res.error_string = "Aborting LDAP requests due to failure";
 
index 9251b926988a331e07c2ad9bf5a1ebdc9f1f67ba..564dda69bd7185501fa40a73b16c8bf6488c9463 100644 (file)
@@ -138,7 +138,7 @@ static bool astream_want_attachment(struct attachment_istream *astream,
        if (astream->set.want_attachment == NULL)
                return TRUE;
 
-       memset(&ahdr, 0, sizeof(ahdr));
+       i_zero(&ahdr);
        ahdr.part = part;
        ahdr.content_type = astream->part.content_type;
        ahdr.content_disposition = astream->part.content_disposition;
@@ -461,7 +461,7 @@ astream_part_finish(struct attachment_istream *astream, const char **error_r)
                return -1;
        }
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.start_offset = astream->part.start_offset;
        /* base64_bytes contains how many valid base64 bytes there are so far.
           if the base64 ends properly, it'll specify how much of the MIME part
@@ -543,7 +543,7 @@ static void astream_part_reset(struct attachment_istream *astream)
        if (part->part_buf != NULL)
                buffer_free(&part->part_buf);
 
-       memset(part, 0, sizeof(*part));
+       i_zero(part);
        part->temp_fd = -1;
        hash_format_reset(astream->set.hash_format);
 }
index 3eb97458161e25d0f3efc597621919a43c7aa579..0bf5f4e320f4c13d6ab31bbe096d96c11a9bbdb5 100644 (file)
@@ -100,7 +100,7 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
        if (msg+29-3-5 > msg_end)
                return -1;
 
-       memset(&tm, 0, sizeof(tm));
+       i_zero(&tm);
 
        /* skip weekday */
        msg += 4;
index 90b1175f9af3fdd0612944ba63d9925bfc81eb35..376d019083cbe3ab452b1e8c2bf7803b37eb8bb9 100644 (file)
@@ -24,7 +24,7 @@ static void add_address(struct message_address_parser_context *ctx)
        addr = p_new(ctx->pool, struct message_address, 1);
 
        memcpy(addr, &ctx->addr, sizeof(ctx->addr));
-       memset(&ctx->addr, 0, sizeof(ctx->addr));
+       i_zero(&ctx->addr);
 
        if (ctx->first_addr == NULL)
                ctx->first_addr = addr;
@@ -363,7 +363,7 @@ message_address_parse_real(pool_t pool, const unsigned char *data, size_t size,
 {
        struct message_address_parser_context ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
 
        rfc822_parser_init(&ctx.parser, data, size, t_str_new(128));
        ctx.pool = pool;
index ae11d6a045439ce83e12190a88218df2d686edda..169e02168d2191493c2fee9ba0ffc62a1681b3ef 100644 (file)
@@ -121,7 +121,7 @@ message_date_parser_tokens(struct message_date_parser_context *ctx,
        int ret;
 
        /* [weekday_name "," ] dd month_name [yy]yy hh:mi[:ss] timezone */
-       memset(&tm, 0, sizeof(tm));
+       i_zero(&tm);
 
         rfc822_skip_lwsp(&ctx->parser);
 
index 469629799fa512121e84936dbde00cb55c017192..798c411009632e532831fdb2b8b942590a2301fc 100644 (file)
@@ -178,7 +178,7 @@ void message_header_decode_utf8(const unsigned char *data, size_t size,
 {
        struct decode_utf8_context ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.dest = dest;
        ctx.normalizer = normalizer;
        message_header_decode(data, size, decode_utf8_callback, &ctx);
index 096586d0093f5fa5a496007dc6a076ad637ae7fa..02c608c96346c126012ea16fc331ede5df42de92 100644 (file)
@@ -36,7 +36,7 @@ message_parse_header_init(struct istream *input, struct message_size *hdr_size,
        i_stream_ref(input);
 
        if (hdr_size != NULL)
-               memset(hdr_size, 0, sizeof(*hdr_size));
+               i_zero(hdr_size);
        return ctx;
 }
 
index 76753e8663306fbab859b4371aeab074bd87f290..128851bb9fd0ffe512cf1aa864efb6e361e8b29d 100644 (file)
@@ -1113,7 +1113,7 @@ int message_parser_parse_next_block(struct message_parser_ctx *ctx,
        int ret;
        bool eof = FALSE, full;
 
-       memset(block_r, 0, sizeof(*block_r));
+       i_zero(block_r);
 
        while ((ret = ctx->parse_next_block(ctx, block_r)) == 0) {
                ret = message_parser_read_more(ctx, block_r, &full);
index 93bb55bfa8fdc6de6a5375b3cbf59ed3723e36c0..b2f22de3fcb79a7f4f2b899b61fa4839f3e02706 100644 (file)
@@ -250,7 +250,7 @@ message_part_deserialize(pool_t pool, const void *data, size_t size,
        struct deserialize_context ctx;
         struct message_part *part;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool;
        ctx.data = data;
        ctx.end = ctx.data + size;
index 3520f78f9219e816032f8fabd41eadf74ec91766..00d0f3afe03715a9baf664f9334bae3e880d6dff 100644 (file)
@@ -121,7 +121,7 @@ bool message_search_more_get_decoded(struct message_search_context *ctx,
        struct message_header_line *hdr = raw_block->hdr;
        struct message_block decoded_block;
 
-       memset(decoded_block_r, 0, sizeof(*decoded_block_r));
+       i_zero(decoded_block_r);
        decoded_block_r->part = raw_block->part;
 
        if (raw_block->part != ctx->prev_part) {
index 2f3cf427505f9cb4d58508e40e736b7272c3e862..a877be37670d53c0437f7643417a3d5d195b3ca8 100644 (file)
@@ -103,7 +103,7 @@ int message_snippet_generate(struct istream *input,
        pool_t pool;
        int ret;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        pool = pool_alloconly_create("message snippet", 1024);
        ctx.snippet = snippet;
        ctx.chars_left = max_snippet_chars;
index 7d9d246b46f5c926983653ce44a0bed72e660e55..4551db98ea7250f36a4fe1c5948563ea98a4427a 100644 (file)
@@ -52,7 +52,7 @@ int rfc2231_parse(struct rfc822_parser_context *ctx,
        /* Get a list of all parameters. RFC 2231 uses key*<n>[*]=value pairs,
           which we want to merge to a key[*]=value pair. Save them to a
           separate array. */
-       memset(&rfc2231_param, 0, sizeof(rfc2231_param));
+       i_zero(&rfc2231_param);
        t_array_init(&result, 8);
        t_array_init(&rfc2231_params_arr, 8);
        while ((ret = rfc822_parse_content_param(ctx, &key, &value)) != 0) {
index 9075ba0716c675e55981c390331e828549fc3c6d..c6b31b4949e734ad6b33c9c6411c9f3a14f0094d 100644 (file)
@@ -55,7 +55,7 @@ void rfc822_parser_init(struct rfc822_parser_context *ctx,
                        const unsigned char *data, size_t size,
                        string_t *last_comment)
 {
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ctx->data = data;
        ctx->end = data + size;
        ctx->last_comment = last_comment;
index 3685817b6ebb86d0cd3bfd397d782943a7036e17..965ee8396993bb3fdec2c5ef2e1a78347c40dd5e 100644 (file)
@@ -231,7 +231,7 @@ get_istream_attachment_settings(struct istream_attachment_settings *set_r)
 {
        const char *error;
 
-       memset(set_r, 0, sizeof(*set_r));
+       i_zero(set_r);
        set_r->min_size = 1;
        set_r->drain_parent_input = TRUE;
        set_r->open_temp_fd = test_open_temp_fd;
index 068a62f7cce05985ff0cc06b428a8c12cac60502..8b314327b8b42fc3869a052898e2916834abb95b 100644 (file)
@@ -24,14 +24,14 @@ static void test_message_decoder(void)
 
        test_begin("message decoder");
 
-       memset(&part, 0, sizeof(part));
-       memset(&input, 0, sizeof(input));
+       i_zero(&part);
+       i_zero(&input);
        memset(&output, 0xff, sizeof(output));
        input.part = &part;
 
        ctx = message_decoder_init(NULL, 0);
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.name = "Content-Transfer-Encoding";
        hdr.name_len = strlen(hdr.name);
        hdr.full_value = (const void *)"quoted-printable";
@@ -91,10 +91,10 @@ static void test_message_decoder_current_content_type(void)
 
        test_begin("message_decoder_current_content_type()");
 
-       memset(&part, 0, sizeof(part));
+       i_zero(&part);
        part2 = part3 = part;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        memset(&output, 0xff, sizeof(output));
        input.part = &part;
 
@@ -102,7 +102,7 @@ static void test_message_decoder_current_content_type(void)
        test_assert(message_decoder_current_content_type(ctx) == NULL);
 
        /* multipart/mixed */
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.name = "Content-Type";
        hdr.name_len = strlen(hdr.name);
        hdr.full_value = (const void *)"multipart/mixed; boundary=x";
index c02ad8b707ab8f1593d6462d94b48e4642de2f5f..de75359eeac44f591ffdc5cf42f3b6157683a77f 100644 (file)
@@ -20,7 +20,7 @@ static void test_dsync_mail_hash_more(void)
 
        test_begin("dsync_mail_hash_more v2");
        md5_init(&md5_ctx);
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        message_header_hash_more(&ctx, &hash_method_md5, &md5_ctx, 2,
                                 test_input, sizeof(test_input)-1);
        md5_final(&md5_ctx, md5_input);
@@ -33,7 +33,7 @@ static void test_dsync_mail_hash_more(void)
 
        /* single byte at a time */
        md5_init(&md5_ctx);
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        for (unsigned int i = 0; i < sizeof(test_input)-1; i++) {
                message_header_hash_more(&ctx, &hash_method_md5, &md5_ctx, 2,
                                         test_input + i, 1);
index c115ed21acc15e3f185a8df4fc8d0608267e3416..4566a709fb21ed6d37dcf46b8803761902b753d6 100644 (file)
@@ -22,11 +22,11 @@ static void test_message_search_more_get_decoded(void)
        ctx1 = message_search_init("p\xC3\xA4\xC3\xA4", NULL, 0);
        ctx2 = message_search_init("p\xC3\xB6\xC3\xB6", NULL, 0);
 
-       memset(&raw_block, 0, sizeof(raw_block));
+       i_zero(&raw_block);
        raw_block.part = &part;
 
        /* feed the Content-Type header */
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        hdr.name = "Content-Type"; hdr.name_len = strlen(hdr.name);
        hdr.value = hdr.full_value = text_plain;
        hdr.value_len = hdr.full_value_len = sizeof(text_plain)-1;
index 2a048f3ff63048e4359b329a9cd30079b2ab7127..d35bd4e0918ac90b899e41c37fb0c4273877fadb 100644 (file)
@@ -227,7 +227,7 @@ void master_auth_request(struct master_auth *auth, int fd,
 {
        struct master_auth_request_params params;
 
-       memset(&params, 0, sizeof(params));
+       i_zero(&params);
        params.client_fd = fd;
        params.request = *request;
        params.data = data;
index 960078c6b08d4234d3efe49327875c9072ed5407..f914cee163dc13e92ab0abdaa65f0425ac929079 100644 (file)
@@ -353,7 +353,7 @@ master_login_auth_callback(const char *const *auth_args, const char *errormsg,
        struct master_login_connection *conn = client->conn;
        struct master_auth_reply reply;
 
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        reply.tag = client->auth_req.tag;
        reply.status = errormsg == NULL ? MASTER_AUTH_STATUS_OK :
                MASTER_AUTH_STATUS_INTERNAL_ERROR;
index 895f5daa1137b2b7ba5b5bccb8d867d698006b82..1b5e4545362e59b6d63ea3a1902e68a2a110fc5a 100644 (file)
@@ -377,7 +377,7 @@ void master_service_config_socket_try_open(struct master_service *service)
            (service->flags & MASTER_SERVICE_FLAG_NO_CONFIG_SETTINGS) != 0)
                return;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.never_exec = TRUE;
        fd = master_service_open_config(service, &input, &path, &error);
        if (fd != -1)
@@ -400,7 +400,7 @@ int master_service_settings_read(struct master_service *service,
        time_t now, timeout;
        bool use_environment, retry;
 
-       memset(output_r, 0, sizeof(*output_r));
+       i_zero(output_r);
 
        if (getenv("DOVECONF_ENV") == NULL &&
            (service->flags & MASTER_SERVICE_FLAG_NO_CONFIG_SETTINGS) == 0) {
@@ -547,7 +547,7 @@ int master_service_settings_read_simple(struct master_service *service,
        struct master_service_settings_input input;
        struct master_service_settings_output output;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = roots;
        input.module = service->name;
        return master_service_settings_read(service, &input, &output, error_r);
index 4dfbd8b9e3c96eb50c8f8e20c93f31ef38a925b6..08e4a03cfe8a62ff26729c188ee81903f46c42a5 100644 (file)
@@ -28,7 +28,7 @@ int master_service_ssl_init(struct master_service *service,
 
        set = master_service_ssl_settings_get(service);
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.verbose = set->verbose_ssl;
        ssl_set.verify_remote_cert = set->ssl_verify_client_cert;
        return io_stream_create_ssl_server(service->ssl_ctx, &ssl_set,
@@ -60,7 +60,7 @@ void master_service_ssl_ctx_init(struct master_service *service)
                return;
        }
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        ssl_set.protocols = set->ssl_protocols;
        ssl_set.cipher_list = set->ssl_cipher_list;
        ssl_set.ca = set->ssl_ca;
index af48f2c9c047fbb8e639e634e533f66c37e11cc9..f3c4c653a95469b1ebc13c04222d062abfcc2625 100644 (file)
@@ -918,7 +918,7 @@ static void master_service_listen(struct master_service_listener *l)
                }
        }
 
-       memset(&conn, 0, sizeof(conn));
+       i_zero(&conn);
        conn.listen_fd = l->fd;
        conn.fd = net_accept(l->fd, &conn.remote_ip, &conn.remote_port);
        if (conn.fd < 0) {
index 9463efd9180c6428bb5d126bdcc42d20812667b8..54584a5cad3ce54ca61e1b7c8ff1f1f26053f3f9 100644 (file)
@@ -101,7 +101,7 @@ int main(void)
        pool_t pool;
        int ret;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "module";
        input.service = "service_name";
 
index bc62651449a98453885669d3fd11a6a097fc87a8..160b9f918c959914a9c2ff91b4f024c76fbf700c 100644 (file)
@@ -86,7 +86,7 @@ static void ntlmssp_append_target_info(buffer_t *buf, size_t buffer_offset, ...)
                const char *data;
                type = va_arg(args, int);
 
-               memset(&info, 0, sizeof(info));
+               i_zero(&info);
                write_le16(&info.type, type);
 
                switch (type) {
@@ -151,7 +151,7 @@ ntlmssp_create_challenge(pool_t pool, const struct ntlmssp_request *request,
 
        buf = buffer_create_dynamic(pool, sizeof(struct ntlmssp_challenge));
 
-       memset(&c, 0, sizeof(c));
+       i_zero(&c);
        write_le64(&c.magic, NTLMSSP_MAGIC);
        write_le32(&c.type, NTLMSSP_MSG_TYPE2);
        write_le32(&c.flags, flags);
index 37f69e3efc2638b1baa39528fae19e67090b88a5..f191803005924896d82edd67600681e8e7e1566a 100644 (file)
@@ -111,7 +111,7 @@ copy_unique_defaults(struct setting_parser_context *ctx,
        }
        p_array_init(arr, ctx->set_pool, count + 4);
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info = *def->list_info;
 
        for (i = 0; i < count; i++) T_BEGIN {
@@ -587,7 +587,7 @@ get_deflist(struct setting_parser_context *ctx, struct setting_link *parent,
        if (change_result != NULL && !array_is_created(change_result))
                p_array_init(change_result, ctx->set_pool, 5);
 
-       memset(&new_link, 0, sizeof(new_link));
+       i_zero(&new_link);
        new_link.parent = parent;
        new_link.info = info;
        new_link.array = result;
@@ -2044,8 +2044,8 @@ settings_copy_deflist_unique(const struct setting_define *def,
                return 0;
        type_offset = def->list_info->type_offset;
 
-       memset(&child_dest_link, 0, sizeof(child_dest_link));
-       memset(&child_src_link, 0, sizeof(child_src_link));
+       i_zero(&child_dest_link);
+       i_zero(&child_src_link);
 
        child_dest_link.info = child_src_link.info = def->list_info;
 
index 6ddd7aaf72eba97406052d0c72e6ea3be80b54c7..356b7a5d13b2837d35951dbadf2a0aa5b9e5841a 100644 (file)
@@ -195,7 +195,7 @@ bool settings_read_i(const char *path, const char *section,
                next_section = t_strcut(section, '/');
        }
 
-       memset(&root, 0, sizeof(root));
+       i_zero(&root);
        root.path = path;
        input = &root;
 
index e037d191b64a3e6a1829bd79d5304cc172267874..27921d73b6ff90b1bf863087b94c805b6c11bd20 100644 (file)
@@ -1177,7 +1177,7 @@ transaction_commit_callback(struct sql_result *result, void *context)
        struct cassandra_transaction_context *ctx = context;
        struct sql_commit_result commit_result;
 
-       memset(&commit_result, 0, sizeof(commit_result));
+       i_zero(&commit_result);
        if (sql_result_next_row(result) < 0) {
                commit_result.error = sql_result_get_error(result);
                commit_result.error_type = sql_result_get_error_type(result);
@@ -1195,7 +1195,7 @@ driver_cassandra_transaction_commit(struct sql_transaction_context *_ctx,
        enum cassandra_query_type query_type;
        struct sql_commit_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        ctx->callback = callback;
        ctx->context = context;
 
index 93b05466a81b6f6459d281bb6f1f8690f23c005a..22018090f3db5b43655e920c91c77d738a8e8718 100644 (file)
@@ -544,7 +544,7 @@ driver_mysql_transaction_commit(struct sql_transaction_context *ctx,
        struct sql_commit_result result;
        const char *error;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        if (sql_transaction_commit_s(&ctx, &error) < 0)
                result.error = error;
        callback(&result, context);
index fbfa684aa26896cabe9b759548c73eee19086c53..4dbc57253f871caf393c8b4a0c7209315b2bfbf8 100644 (file)
@@ -875,7 +875,7 @@ transaction_commit_callback(struct sql_result *result,
 {
        struct sql_commit_result commit_result;
 
-       memset(&commit_result, 0, sizeof(commit_result));
+       i_zero(&commit_result);
        if (sql_result_next_row(result) < 0) {
                commit_result.error = sql_result_get_error(result);
                commit_result.error_type = sql_result_get_error_type(result);
@@ -920,7 +920,7 @@ transaction_commit_error_callback(struct pgsql_transaction_context *ctx,
 {
        struct sql_commit_result commit_result;
 
-       memset(&commit_result, 0, sizeof(commit_result));
+       i_zero(&commit_result);
        commit_result.error = sql_result_get_error(result);
        commit_result.error_type = sql_result_get_error_type(result);
 
@@ -992,7 +992,7 @@ transaction_trans_query_callback(struct sql_result *result,
                                query->affected_rows) < 0)
                        i_unreached();
        }
-       memset(&commit_result, 0, sizeof(commit_result));
+       i_zero(&commit_result);
        ctx->callback(&commit_result, ctx->context);
        driver_pgsql_transaction_free(ctx);
 }
@@ -1005,7 +1005,7 @@ driver_pgsql_transaction_commit(struct sql_transaction_context *_ctx,
                (struct pgsql_transaction_context *)_ctx;
        struct sql_commit_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        ctx->callback = callback;
        ctx->context = context;
 
index 0f6d82fe7339663a62972ce9feb87998c93be851..89d88704545341a5cb8723889319477d181aa477 100644 (file)
@@ -344,7 +344,7 @@ driver_sqlite_transaction_commit(struct sql_transaction_context *_ctx,
                        ctx->failed = TRUE;
        }
 
-       memset(&commit_result, 0, sizeof(commit_result));
+       i_zero(&commit_result);
        if (ctx->failed) {
                commit_result.error = sqlite3_errmsg(db->sqlite);
                callback(&commit_result, context);
index 698e69260dcceffd1549e5b41ab734bd061fa28d..c2de246433d97b2933de2a5c3459f48777812cf1 100644 (file)
@@ -30,7 +30,7 @@ static int ssl_module_load(const char **error_r)
        const char *plugin_name = "ssl_iostream_openssl";
        struct module_dir_load_settings mod_set;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.setting_name = "<built-in lib-ssl-iostream lookup>";
        mod_set.require_init_funcs = TRUE;
index 901a9656144e1e6a8e85865cd9cf359b0ebfa48e..f46d0f08a15f52908ca34563e33797923cfa63d3 100644 (file)
@@ -57,7 +57,7 @@ void dbox_save_begin(struct dbox_save_context *ctx, struct istream *input)
        i_stream_unref(&crlf_input);
 
        /* write a dummy header. it'll get rewritten when we're finished */
-       memset(&dbox_msg_hdr, 0, sizeof(dbox_msg_hdr));
+       i_zero(&dbox_msg_hdr);
        o_stream_cork(ctx->dbox_output);
        if (o_stream_send(ctx->dbox_output, &dbox_msg_hdr,
                          sizeof(dbox_msg_hdr)) < 0) {
@@ -132,7 +132,7 @@ void dbox_save_write_metadata(struct mail_save_context *_ctx,
        string_t *str;
        uoff_t vsize;
 
-       memset(&metadata_hdr, 0, sizeof(metadata_hdr));
+       i_zero(&metadata_hdr);
        memcpy(metadata_hdr.magic_post, DBOX_MAGIC_POST,
               sizeof(metadata_hdr.magic_post));
        o_stream_nsend(output, &metadata_hdr, sizeof(metadata_hdr));
index 7cb906c78a0236fc34eac423b77a490cbd579265..b3da77787ceb28d0c02f1f560e7a46cefb33a2bc 100644 (file)
@@ -183,7 +183,7 @@ static int mdbox_deleted_sync(struct mdbox_mailbox *mbox,
        if (mdbox_deleted_mailbox_create_indexes(&mbox->box, NULL, NULL) < 0)
                return -1;
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.save_date = ioloop_time;
 
        sync_flags = index_storage_get_sync_flags(&mbox->box);
index 9a3a686a70468d969c76ddf1e7416cc7debfaaaf..4f42b92d9faa12576accbc6177e754d1fb4f464a 100644 (file)
@@ -259,7 +259,7 @@ mdbox_map_get_ext_hdr(struct mdbox_map *map, struct mail_index_view *view,
        size_t data_size;
 
        mail_index_get_header_ext(view, map->map_ext_id, &data, &data_size);
-       memset(hdr_r, 0, sizeof(*hdr_r));
+       i_zero(hdr_r);
        memcpy(hdr_r, data, I_MIN(data_size, sizeof(*hdr_r)));
 }
 
@@ -382,7 +382,7 @@ int mdbox_map_view_lookup_rec(struct mdbox_map *map,
        const uint16_t *ref16_p;
        const void *data;
 
-       memset(rec_r, 0, sizeof(*rec_r));
+       i_zero(rec_r);
        mail_index_lookup_uid(view, seq, &rec_r->map_uid);
 
        mail_index_lookup_ext(view, seq, map->map_ext_id, &data, NULL);
@@ -414,7 +414,7 @@ int mdbox_map_get_file_msgs(struct mdbox_map *map, uint32_t file_id,
                return -1;
        hdr = mail_index_get_header(map->view);
 
-       memset(&msg, 0, sizeof(msg));
+       i_zero(&msg);
        for (seq = 1; seq <= hdr->messages_count; seq++) {
                if (mdbox_map_view_lookup_rec(map, map->view, seq, &rec) < 0)
                        return -1;
@@ -1297,7 +1297,7 @@ int mdbox_map_append_assign_map_uids(struct mdbox_map_append_context *ctx,
                return -1;
 
        /* append map records to index */
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        ref16 = 1;
        appends = array_get(&ctx->appends, &count);
        for (i = 0; i < count; i++) {
@@ -1359,7 +1359,7 @@ int mdbox_map_append_move(struct mdbox_map_append_context *ctx,
        if (mdbox_map_assign_file_ids(ctx, FALSE, "purging - update uids") < 0)
                return -1;
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        appends = array_get(&ctx->appends, &appends_count);
 
        next_uid = mail_index_get_header(ctx->atomic->sync_view)->next_uid;
index e8f8f3264117f30c15b3a1e2ee1a3886cc746182..ccb78c47c2fd7c5823b65bf98bdfa6df9f5dba27 100644 (file)
@@ -257,7 +257,7 @@ mdbox_save_set_map_uids(struct mdbox_save_context *ctx,
 
        mdbox_update_header(mbox, ctx->ctx.trans, NULL);
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.save_date = ioloop_time;
        mails = array_get(&ctx->mails, &count);
        for (i = 0; i < count; i++) {
@@ -446,7 +446,7 @@ int mdbox_copy(struct mail_save_context *_ctx, struct mail *mail)
                return mail_storage_copy(_ctx, mail);
        src_mbox = (struct mdbox_mailbox *)mail->box;
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.save_date = ioloop_time;
        if (mdbox_mail_lookup(src_mbox, mail->transaction->view, mail->seq,
                              &rec.map_uid) < 0) {
index 9b3e1224257f4e31dd95382f91c433b1ca89ff8a..1f8a483bd37805fb52408b3868b7ebfa4501f5c6 100644 (file)
@@ -312,7 +312,7 @@ rebuild_add_missing_map_uids(struct mdbox_storage_rebuild_context *ctx,
        unsigned int i, count;
        uint32_t seq;
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        msgs = array_get_modifiable(&ctx->msgs, &count);
        for (i = 0; i < count; i++) {
                if (msgs[i]->map_uid != 0)
@@ -425,7 +425,7 @@ rebuild_mailbox_multi(struct mdbox_storage_rebuild_context *ctx,
                mail_index_lookup_ext(view, old_seq, mbox->ext_id,
                                      &data, NULL);
                if (data == NULL) {
-                       memset(&new_dbox_rec, 0, sizeof(new_dbox_rec));
+                       i_zero(&new_dbox_rec);
                        map_uid = 0;
                } else {
                        memcpy(&new_dbox_rec, data, sizeof(new_dbox_rec));
@@ -486,7 +486,7 @@ mdbox_rebuild_get_header(struct mail_index_view *view, uint32_t hdr_ext_id,
        size_t data_size;
 
        mail_index_get_header_ext(view, hdr_ext_id, &data, &data_size);
-       memset(hdr_r, 0, sizeof(*hdr_r));
+       i_zero(hdr_r);
        memcpy(hdr_r, data, I_MIN(data_size, sizeof(*hdr_r)));
        *need_resize_r = data_size < sizeof(*hdr_r);
 }
@@ -501,7 +501,7 @@ static void mdbox_header_update(struct mdbox_storage_rebuild_context *ctx,
        mdbox_rebuild_get_header(rebuild_ctx->view, mbox->hdr_ext_id,
                                 &hdr, &need_resize);
        if (rebuild_ctx->backup_view == NULL) {
-               memset(&backup_hdr, 0, sizeof(backup_hdr));
+               i_zero(&backup_hdr);
                need_resize = TRUE;
        } else {
                mdbox_rebuild_get_header(rebuild_ctx->backup_view,
@@ -647,7 +647,7 @@ static int rebuild_msg_mailbox_commit(struct rebuild_msg_mailbox *msg)
        if (mail_index_sync_commit(&msg->sync_ctx) < 0)
                return -1;
        mailbox_free(&msg->box);
-       memset(msg, 0, sizeof(*msg));
+       i_zero(msg);
        return 0;
 }
 
@@ -753,7 +753,7 @@ static int rebuild_restore_msg(struct mdbox_storage_rebuild_context *ctx,
        }
 
        /* add the new message */
-       memset(&dbox_rec, 0, sizeof(dbox_rec));
+       i_zero(&dbox_rec);
        dbox_rec.map_uid = msg->map_uid;
        dbox_rec.save_date = ioloop_time;
        mail_index_append(ctx->prev_msg.trans, ctx->prev_msg.next_uid++, &seq);
@@ -917,7 +917,7 @@ static int mdbox_storage_rebuild_scan(struct mdbox_storage_rebuild_context *ctx)
        mail_index_get_header_ext(ctx->atomic->sync_view,
                                  ctx->storage->map->map_ext_id,
                                  &data, &data_size);
-       memset(&ctx->orig_map_hdr, 0, sizeof(ctx->orig_map_hdr));
+       i_zero(&ctx->orig_map_hdr);
        memcpy(&ctx->orig_map_hdr, data,
               I_MIN(data_size, sizeof(ctx->orig_map_hdr)));
        ctx->highest_file_id = ctx->orig_map_hdr.highest_file_id;
index 8a5e9f51b5a7c5e5d76857a0725ecbe2afca11f9..74586bf69583177f83abb91f92174a16036679e5 100644 (file)
@@ -215,7 +215,7 @@ int mdbox_read_header(struct mdbox_mailbox *mbox,
                mdbox_storage_set_corrupted(mbox->storage);
                return -1;
        }
-       memset(hdr, 0, sizeof(*hdr));
+       i_zero(hdr);
        if (data_size > 0)
                memcpy(hdr, data, I_MIN(data_size, sizeof(*hdr)));
        *need_resize_r = data_size < sizeof(*hdr);
@@ -230,7 +230,7 @@ void mdbox_update_header(struct mdbox_mailbox *mbox,
        bool need_resize;
 
        if (mdbox_read_header(mbox, &hdr, &need_resize) < 0) {
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
                need_resize = TRUE;
        }
 
@@ -399,7 +399,7 @@ mdbox_mailbox_get_guid(struct mdbox_mailbox *mbox, guid_128_t guid_r)
        }
 
        if (mdbox_read_header(mbox, &hdr, &need_resize) < 0)
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
 
        if (guid_128_is_empty(hdr.mailbox_guid)) {
                /* regenerate it */
index dbb85ff5865698aca14935cbf601121ff13eb091..ed576798ea4ef4248061cc83d9b9fdc50a556cdd 100644 (file)
@@ -162,7 +162,7 @@ int sdbox_read_header(struct sdbox_mailbox *mbox,
                }
                ret = -1;
        } else {
-               memset(hdr, 0, sizeof(*hdr));
+               i_zero(hdr);
                memcpy(hdr, data, I_MIN(data_size, sizeof(*hdr)));
                if (guid_128_is_empty(hdr->mailbox_guid))
                        ret = -1;
@@ -187,7 +187,7 @@ static void sdbox_update_header(struct sdbox_mailbox *mbox,
        bool need_resize;
 
        if (sdbox_read_header(mbox, &hdr, TRUE, &need_resize) < 0) {
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
                need_resize = TRUE;
        }
 
@@ -320,7 +320,7 @@ static int sdbox_mailbox_alloc_index(struct sdbox_mailbox *mbox)
                mail_index_ext_register(mbox->box.index, "dbox-hdr",
                                        sizeof(struct sdbox_index_header), 0, 0);
        /* set the initialization data in case the mailbox is created */
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        guid_128_generate(hdr.mailbox_guid);
        mail_index_set_ext_init_data(mbox->box.index, mbox->hdr_ext_id,
                                     &hdr, sizeof(hdr));
@@ -349,7 +349,7 @@ static int sdbox_mailbox_open(struct mailbox *box)
                /* looks like the mailbox is corrupted */
                (void)sdbox_sync(mbox, SDBOX_SYNC_FLAG_FORCE);
                if (sdbox_read_header(mbox, &hdr, TRUE, &need_resize) < 0)
-                       memset(&hdr, 0, sizeof(hdr));
+                       i_zero(&hdr);
        }
 
        if (guid_128_is_empty(hdr.mailbox_guid)) {
index 65ba9d1446112538cb7d98efe0d28c4fc87bbbe7..5c3351a45353064030ffe7ace2102bedee058499 100644 (file)
@@ -142,7 +142,7 @@ static void sdbox_sync_update_header(struct index_rebuild_context *ctx)
        bool need_resize;
 
        if (sdbox_read_header(mbox, &hdr, FALSE, &need_resize) < 0)
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
        if (guid_128_is_empty(hdr.mailbox_guid))
                guid_128_generate(hdr.mailbox_guid);
        if (++hdr.rebuild_count == 0)
index 2d7327b6aa72a829459ee459307dc62bd86641f8..f4c17f5c590fd2eb5ffe12208a455f709e8560d2 100644 (file)
@@ -610,7 +610,7 @@ imapc_list_build_match_tree(struct imapc_mailbox_list_iterate_context *ctx)
        struct mailbox_node *node;
        const char *name;
 
-       memset(&update_ctx, 0, sizeof(update_ctx));
+       i_zero(&update_ctx);
        update_ctx.iter_ctx = &ctx->ctx;
        update_ctx.tree_ctx = ctx->tree;
        update_ctx.glob = ctx->ctx.glob;
index 54fb2b2f8041c616ae14f7ab3f217ddbd41a1975..8a6e9a65b75717df2a26cd436a9bd4298b1ef848 100644 (file)
@@ -116,7 +116,7 @@ void imapc_copy_error_from_reply(struct imapc_storage *storage,
 void imapc_simple_context_init(struct imapc_simple_context *sctx,
                               struct imapc_storage_client *client)
 {
-       memset(sctx, 0, sizeof(*sctx));
+       i_zero(sctx);
        sctx->client = client;
        sctx->ret = -2;
 }
@@ -261,7 +261,7 @@ int imapc_storage_client_create(struct mail_namespace *ns,
        struct imapc_client_settings set;
        string_t *str;
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.host = imapc_set->imapc_host;
        if (*set.host == '\0') {
                *error_r = "missing imapc_host";
index 39516a928feb4b10f3956f2b9ce37857e30e3176..e6b63c061a9f10880b6c8cb6c4e59098fbacf959 100644 (file)
@@ -45,7 +45,7 @@ static bool index_attachment_want(const struct istream_attachment_header *hdr,
        struct mail_save_context *ctx = context;
        struct mail_attachment_part apart;
 
-       memset(&apart, 0, sizeof(apart));
+       i_zero(&apart);
        apart.part = hdr->part;
        apart.content_type = hdr->content_type;
        apart.content_disposition = hdr->content_disposition;
@@ -168,7 +168,7 @@ void index_attachment_save_begin(struct mail_save_context *ctx,
        if (*storage->set->mail_attachment_dir == '\0')
                return;
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.min_size = storage->set->mail_attachment_min_size;
        if (hash_format_init(storage->set->mail_attachment_hash,
                             &set.hash_format, &error) < 0) {
@@ -380,7 +380,7 @@ bool index_attachment_parse_extrefs(const char *line, pool_t pool,
                const char *decode_options = args[i+2];
                const char *path = args[i+3];
 
-               memset(&extref, 0, sizeof(extref));
+               i_zero(&extref);
                if (str_to_uoff(start_offset_str, &extref.start_offset) < 0 ||
                    str_to_uoff(size_str, &extref.size) < 0 ||
                    extref.start_offset < last_voffset ||
index da84463cae179423969e300c50dd368a9cfc4fc9..2c5fd1fd5891010772d6e0a553b5d16f52bb9a75 100644 (file)
@@ -62,7 +62,7 @@ index_storage_get_user_dict(struct mail_storage *err_storage,
                return -1;
        }
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.username = user->username;
        dict_set.base_dir = user->set->base_dir;
        if (dict_init(attr_storage->set->mail_attribute_dict, &dict_set,
@@ -121,7 +121,7 @@ index_storage_get_dict(struct mailbox *box, enum mail_attribute_type type,
                return -1;
        }
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.username = storage->user->username;
        set.base_dir = storage->user->set->base_dir;
        if (mail_user_get_home(storage->user, &set.home_dir) <= 0)
@@ -231,7 +231,7 @@ int index_storage_attribute_get(struct mailbox *box,
        const char *mailbox_prefix, *error;
        int ret;
 
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
 
        if (index_storage_get_dict(box, type, &dict, &mailbox_prefix) < 0)
                return -1;
index 670a7fe0be534fcd14846a0e706118888dd7f985..bcac3ae0790af2c539d581282241c64409b8c636 100644 (file)
@@ -251,7 +251,7 @@ binary_parts_update(struct binary_ctx *ctx, const struct message_part *part,
        for (; part != NULL; part = part->next) {
                binary_parts_update(ctx, part->children, msg_bin_parts);
 
-               memset(&bin_part, 0, sizeof(bin_part));
+               i_zero(&bin_part);
                /* default to unchanged header */
                bin_part.binary_hdr_size = part->header_size.virtual_size;
                bin_part.physical_pos = part->physical_pos;
@@ -369,7 +369,7 @@ index_mail_read_binary_to_cache(struct mail *_mail,
        struct binary_ctx ctx;
        struct istream *is;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.mail = _mail;
        t_array_init(&ctx.blocks, 8);
 
index cc0a415c0c91fc5f0ec25445c1e404b46fc32a77..bcab63378ce080d54d63011e24c9cd4c3f9ea5b3 100644 (file)
@@ -142,7 +142,7 @@ get_header_field_idx(struct mailbox *box, const char *field,
 {
        struct mail_cache_field header_field;
 
-       memset(&header_field, 0, sizeof(header_field));
+       i_zero(&header_field);
        header_field.type = MAIL_CACHE_FIELD_HEADER;
        header_field.decision = decision;
        T_BEGIN {
@@ -253,7 +253,7 @@ void index_mail_parse_header_init(struct index_mail *mail,
        }
        mail->data.header_parser_initialized = TRUE;
        mail->data.parse_line_num = 0;
-       memset(&mail->data.parse_line, 0, sizeof(mail->data.parse_line));
+       i_zero(&mail->data.parse_line);
 }
 
 static void index_mail_parse_finish_imap_envelope(struct index_mail *mail)
index 3c5a542ca49a01487e9eb81db9aa2d02e623048a..b4ab934b3d61e8b3f366a2a1ddc84eb0e05246f2 100644 (file)
@@ -1554,7 +1554,7 @@ static void index_mail_reset_data(struct index_mail *mail)
 {
        struct index_mail_data *data = &mail->data;
 
-       memset(data, 0, sizeof(*data));
+       i_zero(data);
        p_clear(mail->mail.data_pool);
 
        data->virtual_size = (uoff_t)-1;
index 0153a094b453ff70a688f3d70633084d70a1517d..5980f23d50d3e57dc656294d2946b5e8d05b15ff 100644 (file)
@@ -70,7 +70,7 @@ static void vsize_header_refresh(struct mailbox_vsize_update *update)
                                size);
                }
                update->rebuild = TRUE;
-               memset(&update->vsize_hdr, 0, sizeof(update->vsize_hdr));
+               i_zero(&update->vsize_hdr);
        }
 }
 
@@ -94,7 +94,7 @@ index_mailbox_vsize_check_rebuild(struct mailbox_vsize_update *update)
                } else {
                        /* some messages have been expunged, rescan */
                }
-               memset(&update->vsize_hdr, 0, sizeof(update->vsize_hdr));
+               i_zero(&update->vsize_hdr);
                update->rebuild = TRUE;
        }
 }
@@ -129,7 +129,7 @@ static bool vsize_update_lock_full(struct mailbox_vsize_update *update,
                return FALSE;
 
        perm = mailbox_get_permissions(box);
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.lock_timeout_secs =
                mail_storage_get_lock_timeout(box->storage, lock_secs);
        set.lock_method = box->storage->set->parsed_lock_method;
@@ -221,14 +221,14 @@ void index_mailbox_vsize_hdr_expunge(struct mailbox_vsize_update *update,
        if (update->vsize_hdr.message_count == 0) {
                mail_storage_set_critical(update->box->storage,
                        "vsize-hdr's message_count shrank below 0");
-               memset(&update->vsize_hdr, 0, sizeof(update->vsize_hdr));
+               i_zero(&update->vsize_hdr);
                return;
        }
        update->vsize_hdr.message_count--;
        if (update->vsize_hdr.vsize < vsize) {
                mail_storage_set_critical(update->box->storage,
                        "vsize-hdr's vsize shrank below 0");
-               memset(&update->vsize_hdr, 0, sizeof(update->vsize_hdr));
+               i_zero(&update->vsize_hdr);
                return;
        }
        update->vsize_hdr.vsize -= vsize;
index b5c8e0195d0a748eedd5f7168cd8fd7f0c66e736..282c870080487f881c4a56052c673da4062e8311 100644 (file)
@@ -11,7 +11,7 @@ void index_pop3_uidl_set_max_uid(struct mailbox *box,
 {
        struct mailbox_index_pop3_uidl uidl;
 
-       memset(&uidl, 0, sizeof(uidl));
+       i_zero(&uidl);
        uidl.max_uid_with_pop3_uidl = uid;
 
        mail_index_update_header_ext(trans, box->pop3_uidl_hdr_ext_id,
index 0c2b79284d622dce73c8804ca6ebd1b1f182b659..f4f32fd84a39e8387ada6efcfe3fd34a884637b4 100644 (file)
@@ -133,7 +133,7 @@ index_rebuild_header(struct index_rebuild_context *ctx,
        }
 
        /* set highest-modseq */
-       memset(&modseq_hdr, 0, sizeof(modseq_hdr));
+       i_zero(&modseq_hdr);
        modseq_hdr.highest_modseq = mail_index_modseq_get_highest(ctx->view);
        if (ctx->backup_view != NULL) {
                modseq = mail_index_modseq_get_highest(ctx->backup_view);
index e737d3ac7b6867bd18dc21fcba291f9d41c4845f..829e4af6aeef6ed592ef48f335cdce6c9d35ae93 100644 (file)
@@ -123,7 +123,7 @@ int index_search_result_update_flags(struct mail_search_result *result,
 
        /* add a temporary search parameter to limit the search only to
           the changed messages */
-       memset(&search_arg, 0, sizeof(search_arg));
+       i_zero(&search_arg);
        search_arg.type = SEARCH_UIDSET;
        search_arg.value.seqset = *uids;
        search_arg.next = result->search_args->args;
@@ -152,7 +152,7 @@ int index_search_result_update_appends(struct mail_search_result *result,
 
        /* add a temporary search parameter to limit the search only to
           the new messages */
-       memset(&search_arg, 0, sizeof(search_arg));
+       i_zero(&search_arg);
        search_arg.type = SEARCH_SEQSET;
        t_array_init(&search_arg.value.seqset, 1);
        seq_range_array_add_range(&search_arg.value.seqset,
index e88fad80f9c0e587900b137ee0139fc669fdd249..86b584a19c04ff40c93978557dbbe0e33107fdb0 100644 (file)
@@ -516,7 +516,7 @@ static void search_header_arg(struct mail_search_arg *arg,
                return;
        }
 
-       memset(&block, 0, sizeof(block));
+       i_zero(&block);
 
        /* We're searching only for values, so drop header name and middle
           parts. We use header searching so that MIME words will be decoded. */
@@ -685,7 +685,7 @@ static int search_arg_match_text(struct mail_search_arg *args,
        if (!have_headers && !have_body)
                return -1;
 
-       memset(&hdr_ctx, 0, sizeof(hdr_ctx));
+       i_zero(&hdr_ctx);
        hdr_ctx.index_ctx = ctx;
        /* hdr_ctx.imail is different from imail for mails in
           virtual mailboxes */
@@ -772,7 +772,7 @@ static int search_arg_match_text(struct mail_search_arg *args,
                i_stream_seek(input, hdr_size.physical_size);
        }
 
-       memset(&body_ctx, 0, sizeof(body_ctx));
+       i_zero(&body_ctx);
        body_ctx.index_ctx = ctx;
        body_ctx.input = input;
        (void)mail_get_parts(ctx->cur_mail, &body_ctx.part);
index 162513735cf8d492a79fd5e8fee4eb7beefb0e9e..bd3de017555f4c85f46160c7912212333a8ffc07 100644 (file)
@@ -144,7 +144,7 @@ static void index_sort_reget_sort_ids(struct sort_string_context *ctx)
        array_clear(&ctx->zero_nodes);
        array_clear(&ctx->nonzero_nodes);
 
-       memset(&node, 0, sizeof(node));
+       i_zero(&node);
        node.wanted = TRUE;
        seqs = array_get(&ctx->program->seqs, &count);
        for (i = 0; i < count; i++) {
@@ -226,7 +226,7 @@ void index_sort_list_add_string(struct mail_search_sort_program *program,
        struct sort_string_context *ctx = program->context;
        struct mail_sort_node node;
 
-       memset(&node, 0, sizeof(node));
+       i_zero(&node);
        node.seq = mail->seq;
        node.wanted = TRUE;
 
@@ -742,7 +742,7 @@ static void index_sort_add_missing(struct sort_string_context *ctx)
                else {
                        i_assert(next_seq < seqs[i]);
                        for (seq = next_seq; seq < seqs[i]; seq++) {
-                               memset(&node, 0, sizeof(node));
+                               i_zero(&node);
                                node.seq = seq;
                                index_sort_node_add(ctx, &node);
                        }
index bded618650cf3fae5d0ceabdabe36e5e2a7b97d1..77e2dc830f3348bc9796ae1900d9563108ea8329 100644 (file)
@@ -222,7 +222,7 @@ index_sort_list_finish_float(struct mail_search_sort_program *program)
 
 void index_sort_list_finish(struct mail_search_sort_program *program)
 {
-       memset(&static_node_cmp_context, 0, sizeof(static_node_cmp_context));
+       i_zero(&static_node_cmp_context);
        static_node_cmp_context.program = program;
        static_node_cmp_context.mail = program->temp_mail;
        static_node_cmp_context.reverse =
index d2ec5133836440dc76c18a2988603cdbd837cefc..ee896ae6e6fdfc627e12c64441ae589d8d96a51c 100644 (file)
@@ -47,7 +47,7 @@ static void set_cache_decisions(struct mail_cache *cache,
                if (idx != UINT_MAX) {
                        field = *mail_cache_register_get_field(cache, idx);
                } else if (strncasecmp(name, "hdr.", 4) == 0) {
-                       memset(&field, 0, sizeof(field));
+                       i_zero(&field);
                        field.name = name;
                        field.type = MAIL_CACHE_FIELD_HEADER;
                } else {
@@ -421,7 +421,7 @@ index_storage_mailbox_update_cache(struct mailbox *box,
                        field = old_fields[j];
                } else if (strncmp(updates[i].name, "hdr.", 4) == 0) {
                        /* new header */
-                       memset(&field, 0, sizeof(field));
+                       i_zero(&field);
                        field.name = updates[i].name;
                        field.type = MAIL_CACHE_FIELD_HEADER;
                } else {
@@ -820,7 +820,7 @@ void index_save_context_free(struct mail_save_context *ctx)
        i_free_and_null(ctx->data.guid);
        i_free_and_null(ctx->data.pop3_uidl);
        index_attachment_save_free(ctx);
-       memset(&ctx->data, 0, sizeof(ctx->data));
+       i_zero(&ctx->data);
 
        ctx->unfinished = FALSE;
 }
index 532a3aa7245413d157cef530879370e777fdd61d..763b09fd124019fee8cf5b6f8dccfafaf52c44e2 100644 (file)
@@ -44,7 +44,7 @@ void index_sync_changes_deinit(struct index_sync_changes_context **_ctx)
 void index_sync_changes_reset(struct index_sync_changes_context *ctx)
 {
        array_clear(&ctx->syncs);
-       memset(&ctx->sync_rec, 0, sizeof(ctx->sync_rec));
+       i_zero(&ctx->sync_rec);
 }
 
 void index_sync_changes_delete_to(struct index_sync_changes_context *ctx,
@@ -112,7 +112,7 @@ void index_sync_changes_read(struct index_sync_changes_context *ctx,
                }
 
                if (!mail_index_sync_next(ctx->index_sync_ctx, sync_rec)) {
-                       memset(sync_rec, 0, sizeof(*sync_rec));
+                       i_zero(sync_rec);
                        break;
                }
 
@@ -130,7 +130,7 @@ void index_sync_changes_read(struct index_sync_changes_context *ctx,
                                                          sync_rec->uid1,
                                                          sync_rec->uid2,
                                                          &seq1, &seq2);
-                       memset(sync_rec, 0, sizeof(*sync_rec));
+                       i_zero(sync_rec);
 
                        if (seq1 == 0)
                                break;
index 9c631175fb2c2e4845e9bc663a6490a9e66d50c5..5398c05ab55bac56ed5b10bacb7b8d4257e236ca 100644 (file)
@@ -518,7 +518,7 @@ void index_storage_list_index_update_sync(struct mailbox *box,
                return;
        }
 
-       memset(&new_rec, 0, sizeof(new_rec));
+       i_zero(&new_rec);
        new_rec.size = st.st_size & 0xffffffffU;
        new_rec.mtime = st.st_mtime & 0xffffffffU;
 
index bea7fd0a954067801781e98bccd9d87debfb6559..1fc15e07389c6b23fbea4721f231651fb5c290d5 100644 (file)
@@ -174,7 +174,7 @@ thread_sort_children(struct thread_finish_context *ctx, uint32_t parent_idx,
        struct mail_thread_child_node child;
        unsigned int count;
 
-       memset(&child, 0, sizeof(child));
+       i_zero(&child);
        array_clear(sorted_children);
 
        /* add all child indexes to the array */
@@ -209,7 +209,7 @@ static void gather_base_subjects(struct thread_finish_context *ctx)
        const struct mail_thread_child_node *children;
        uint32_t idx, uid;
 
-       memset(&gather_ctx, 0, sizeof(gather_ctx));
+       i_zero(&gather_ctx);
        gather_ctx.ctx = ctx;
 
        roots = array_get_modifiable(&ctx->roots, &count);
@@ -321,7 +321,7 @@ static void mail_thread_root_thread_merge(struct thread_finish_context *ctx,
                   the current message and the message in the subject
                   table children of the dummy.  Then replace the message
                    in the subject table with the dummy message. */
-               memset(&new_root, 0, sizeof(new_root));
+               i_zero(&new_root);
                new_root.root_idx1 = array_count(&ctx->roots) + 1;
                new_root.node.idx = ctx->next_new_root_idx++;
                new_root.dummy = TRUE;
@@ -466,8 +466,8 @@ static void mail_thread_create_shadows(struct thread_finish_context *ctx,
 
        ctx->use_sent_date = FALSE;
 
-       memset(&root, 0, sizeof(root));
-       memset(&child, 0, sizeof(child));
+       i_zero(&root);
+       i_zero(&child);
 
        /* We may see dummy messages without parents or children. We can't
           free them since the nodes are in an array, but they may get reused
index 1004260ba2225e5d53c2ffe042d1bc4107cb6208..2ac8e18757b3752010e44b7f93c3c93b515ab103 100644 (file)
@@ -579,7 +579,7 @@ int mail_thread_init(struct mailbox *box, struct mail_search_args *args,
                mail_thread_deinit(&ctx);
                return -1;
        } else {
-               memset(&ctx->added_uids, 0, sizeof(ctx->added_uids));
+               i_zero(&ctx->added_uids);
                *ctx_r = ctx;
                return 0;
        }
index 22a4b0a99501315a5bf20ad07ef41864b07883c5..fdea1c5e3b8896c6d4c7f84a0b4c608b16649303 100644 (file)
@@ -188,7 +188,7 @@ int index_transaction_commit(struct mailbox_transaction_context *t,
        struct mail_index_transaction_commit_result result;
        int ret = 0;
 
-       memset(changes_r, 0, sizeof(*changes_r));
+       i_zero(changes_r);
        changes_r->pool = pool_alloconly_create(MEMPOOL_GROWING
                                                "transaction changes", 512);
        p_array_init(&changes_r->saved_uids, changes_r->pool, 32);
index 7b0ae7846282e03aec3f6aaf9f9c659e0c1b0a9f..1bd73ff6b04a9abb7c3dfb374644ac3797476848 100644 (file)
@@ -80,7 +80,7 @@ maildir_copy_hardlink(struct mail_save_context *ctx, struct mail *mail)
        /* hard link to tmp/ with a newly generated filename and later when we
           have uidlist locked, move it to new/cur. */
        dest_fname = maildir_filename_generate();
-       memset(&do_ctx, 0, sizeof(do_ctx));
+       i_zero(&do_ctx);
        do_ctx.dest_path =
                t_strdup_printf("%s/tmp/%s", mailbox_get_path(&dest_mbox->box),
                                dest_fname);
index f968504ab0a6c1ba8f54091bf8800f0149058868..88ce0da893736b148155c34f1b2e2208e7660d89 100644 (file)
@@ -722,7 +722,7 @@ maildir_mail_remove_sizes_from_filename(struct mail *mail,
        if (strchr(fname, MAILDIR_EXTRA_SEP) == NULL)
                return;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.physical_size = (uoff_t)-1;
        if (field == MAIL_FETCH_VIRTUAL_SIZE &&
            maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE,
index e821f24762ceb057b68b88bc9247812dffd85d8b..38701f103b74c3b6fff6f370cd0e33ea8e01e78c 100644 (file)
@@ -486,7 +486,7 @@ int maildir_sync_index(struct maildir_index_sync_context *ctx,
                mailbox_recent_flags_reset(&mbox->box);
 
                first_uid = hdr->messages_count + 1;
-               memset(&empty_hdr, 0, sizeof(empty_hdr));
+               i_zero(&empty_hdr);
                empty_hdr.next_uid = 1;
                hdr = &empty_hdr;
        }
@@ -787,7 +787,7 @@ void maildir_list_index_update_sync(struct mailbox *box,
                return;
        old_rec = data;
 
-       memset(&new_rec, 0, sizeof(new_rec));
+       i_zero(&new_rec);
        if (mhdr->new_check_time <= mhdr->new_mtime + MAILDIR_SYNC_SECS ||
            mhdr->cur_check_time <= mhdr->cur_mtime + MAILDIR_SYNC_SECS) {
                /* dirty, we need a refresh next time */
index f429e907d848992b6772080ae6c187ef085cd69e..b63966824df567938e14f15e5879fd079eb7d170 100644 (file)
@@ -1990,7 +1990,7 @@ static void maildir_uidlist_swap(struct maildir_uidlist_sync_ctx *ctx)
 
        hash_table_destroy(&uidlist->files);
        uidlist->files = ctx->files;
-       memset(&ctx->files, 0, sizeof(ctx->files));
+       i_zero(&ctx->files);
 
        if (uidlist->record_pool != NULL)
                pool_unref(&uidlist->record_pool);
index 99cf5b1780901d3c4c41bc2e3a53571a0ae121cb..f28637ec681a6a7d65aa27c4c1f2f64bbed5dfad 100644 (file)
@@ -412,7 +412,7 @@ mbox_lock_dotlock_int(struct mbox_lock_context *ctx, int lock_type, bool try)
 
         ctx->dotlock_last_stale = TRUE;
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.use_excl_lock = mbox->storage->storage.set->dotlock_use_excl;
        set.nfs_flush = mbox->storage->storage.set->mail_nfs_storage;
        set.timeout = mail_storage_get_lock_timeout(&mbox->storage->storage,
@@ -607,7 +607,7 @@ static int mbox_lock_fcntl(struct mbox_lock_context *ctx, int lock_type,
        if (lock_type == F_UNLCK && ctx->mbox->mbox_fd == -1)
                return 1;
 
-       memset(&fl, 0, sizeof(fl));
+       i_zero(&fl);
        fl.l_type = lock_type;
        fl.l_whence = SEEK_SET;
        fl.l_start = 0;
@@ -724,7 +724,7 @@ static int mbox_update_locking(struct mbox_mailbox *mbox, int lock_type,
                mail_storage_get_lock_timeout(&mbox->storage->storage,
                        mbox->storage->set->mbox_lock_timeout);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.mbox = mbox;
 
        if (mbox->mbox_lock_type == F_WRLCK) {
@@ -874,7 +874,7 @@ int mbox_unlock(struct mbox_mailbox *mbox, unsigned int lock_id)
        if (mbox->mbox_stream != NULL)
                istream_raw_mbox_set_unlocked(mbox->mbox_stream);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.mbox = mbox;
 
        for (i = 0; i < MBOX_LOCK_COUNT; i++)
index 1437a6ec18d627bb7f35399491ee0f1adb7c8d48..d0b8230b531aaaabe6715ba05694cd25f40a2dde 100644 (file)
@@ -647,7 +647,7 @@ int mbox_save_continue(struct mail_save_context *_ctx)
                if (ctx->x_delivery_id_header != NULL) {
                        struct message_header_line hdr;
 
-                       memset(&hdr, 0, sizeof(hdr));
+                       i_zero(&hdr);
                        hdr.name = ctx->x_delivery_id_header;
                        hdr.name_len = sizeof("X-Delivery-ID")-1;
                        hdr.middle = (const unsigned char *)hdr.name +
index c11f1a605579f301c3d91c0054e9b07a2e134511..e4bcb15a75081dfc9d639ca2a9c196c3dbad4773 100644 (file)
@@ -83,7 +83,7 @@ void mbox_list_index_update_sync(struct mailbox *box,
                return;
        old_rec = data;
 
-       memset(&new_rec, 0, sizeof(new_rec));
+       i_zero(&new_rec);
        new_rec.mtime = mhdr->sync_mtime;
        new_rec.size = mhdr->sync_size & 0xffffffffU;
 
index 7f36f5704443451e614376a5939fe64f8b58b930..f2e9cdb0f8541dd0cd1d707a627f1dc4949af75a 100644 (file)
@@ -572,7 +572,7 @@ bool mbox_sync_parse_match_mail(struct mbox_mailbox *mbox,
           exists. */
 
        mail_index_lookup_uid(view, seq, &uid);
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
         mbox_md5_ctx = mbox->md5_v.init();
 
        hdr_ctx = message_parse_header_init(mbox->mbox_stream, NULL, 0);
index e685dfdb5f83e329cfc3abfb4f14b0d2313d1391..18608b134404e3ea8b2ed77a5d81d1219ab6f565 100644 (file)
@@ -335,7 +335,7 @@ static int mbox_sync_read_next(struct mbox_sync_context *sync_ctx,
        unsigned int first_mail_expunge_extra;
        uint32_t orig_next_uid;
 
-       memset(mail_ctx, 0, sizeof(*mail_ctx));
+       i_zero(mail_ctx);
        mail_ctx->sync_ctx = sync_ctx;
        mail_ctx->seq = seq;
        mail_ctx->header = sync_ctx->header;
index d45189b91a8d5460a759a6794a5b14e2fca9b617..0d242a37d0a3d896fd7d6d2056145262936266c6 100644 (file)
@@ -139,7 +139,7 @@ mbox_sync_read_next_mail(struct mbox_sync_context *sync_ctx,
                return 0;
 
        p_clear(sync_ctx->mail_keyword_pool);
-       memset(mail_ctx, 0, sizeof(*mail_ctx));
+       i_zero(mail_ctx);
        mail_ctx->sync_ctx = sync_ctx;
        mail_ctx->seq = ++sync_ctx->seq;
        mail_ctx->header = sync_ctx->header;
@@ -720,7 +720,7 @@ static int mbox_sync_handle_header(struct mbox_sync_mail_context *mail_ctx)
                        i_assert(postlf_from_offset != (uoff_t)-1);
                        mail_ctx->mail.from_offset = postlf_from_offset;
 
-                       memset(&mail, 0, sizeof(mail));
+                       i_zero(&mail);
                        mail.expunged = TRUE;
                        mail.offset = mail.from_offset =
                                mail_ctx->mail.from_offset -
@@ -816,7 +816,7 @@ mbox_sync_handle_missing_space(struct mbox_sync_mail_context *mail_ctx)
 
        /* mail_ctx may contain wrong data after rewrite, so make sure we
           don't try to access it */
-       memset(mail_ctx, 0, sizeof(*mail_ctx));
+       i_zero(mail_ctx);
 
        sync_ctx->need_space_seq = 0;
        sync_ctx->space_diff = 0;
@@ -1701,7 +1701,7 @@ int mbox_sync_header_refresh(struct mbox_mailbox *mbox)
                                  &data, &data_size);
        if (data_size == 0) {
                /* doesn't exist yet. */
-               memset(&mbox->mbox_hdr, 0, sizeof(mbox->mbox_hdr));
+               i_zero(&mbox->mbox_hdr);
                return 0;
        }
 
@@ -1905,7 +1905,7 @@ again:
                return 0;
        }
 
-       memset(&sync_ctx, 0, sizeof(sync_ctx));
+       i_zero(&sync_ctx);
        sync_ctx.mbox = mbox;
        sync_ctx.keep_recent =
                (mbox->box.flags & MAILBOX_FLAG_DROP_RECENT) == 0;
index 1193e07192a77d96153aa3f11a5309a353c1bb94..0b6eeb4d5195cdfc56353af445ea9c3390e4dd04 100644 (file)
@@ -120,7 +120,7 @@ pop3c_client_init(const struct pop3c_client_settings *set)
                client->set.ssl_ca_file = p_strdup(pool, set->ssl_ca_file);
                client->set.ssl_verify = set->ssl_verify;
 
-               memset(&ssl_set, 0, sizeof(ssl_set));
+               i_zero(&ssl_set);
                ssl_set.ca_dir = set->ssl_ca_dir;
                ssl_set.ca_file = set->ssl_ca_file;
                ssl_set.verify_remote_cert = set->ssl_verify;
@@ -281,7 +281,7 @@ static int pop3c_client_dns_lookup(struct pop3c_client *client)
                client->ip = ips[0];
                pop3c_client_connect_ip(client);
        } else {
-               memset(&dns_set, 0, sizeof(dns_set));
+               i_zero(&dns_set);
                dns_set.dns_client_socket_path =
                        client->set.dns_client_socket_path;
                dns_set.timeout_msecs = POP3C_DNS_LOOKUP_TIMEOUT_MSECS;
@@ -566,7 +566,7 @@ static int pop3c_client_ssl_init(struct pop3c_client *client)
                return -1;
        }
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
+       i_zero(&ssl_set);
        if (client->set.ssl_verify) {
                ssl_set.verbose_invalid_cert = TRUE;
                ssl_set.verify_remote_cert = TRUE;
@@ -803,7 +803,7 @@ int pop3c_client_cmd_line(struct pop3c_client *client, const char *cmdline,
 {
        struct pop3c_client_sync_cmd_ctx ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        pop3c_client_cmd_line_async(client, cmdline, pop3c_client_cmd_reply, &ctx);
        while (ctx.reply == NULL)
                pop3c_client_wait_one(client);
@@ -875,7 +875,7 @@ int pop3c_client_cmd_stream(struct pop3c_client *client, const char *cmdline,
                return -1;
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        *input_r = pop3c_client_cmd_stream_async(client, cmdline,
                                                 pop3c_client_cmd_reply, &ctx);
        while (ctx.reply == NULL)
index 490cef1c75b14deb84db7d6645fe583ec8b0ff1e..0530f871b18cac6ea27e376480894af7b4788e39 100644 (file)
@@ -56,7 +56,7 @@ pop3c_client_create_from_set(struct mail_storage *storage,
        struct pop3c_client_settings client_set;
        string_t *str;
 
-       memset(&client_set, 0, sizeof(client_set));
+       i_zero(&client_set);
        client_set.host = set->pop3c_host;
        client_set.port = set->pop3c_port;
        client_set.username = set->pop3c_user;
index 489253761d28d824cd54af0040406ee2d56a5389..478cffa73e5ca87714bea2e0f605139b0c9857e3 100644 (file)
@@ -146,7 +146,7 @@ pop3c_get_local_msgs(pool_t pool, ARRAY_TYPE(pop3c_sync_msg) *local_msgs,
        struct pop3c_sync_msg msg;
        uint32_t seq;
 
-       memset(&msg, 0, sizeof(msg));
+       i_zero(&msg);
        for (seq = 1; seq <= messages_count; seq++) {
                str_truncate(str, 0);
                if (mail_cache_lookup_field(cache_view, str, seq,
index 757c1eb55bc2e4ea8c800fb0d3c857466bdee5d8..eae26973d7885496f8d44a400a6ad48a64f21455 100644 (file)
@@ -358,7 +358,7 @@ index_list_mailbox_create(struct mailbox *box,
                /* if no GUID is requested, generate it ourself. set
                   UIDVALIDITY to index sometimes later. */
                if (update == NULL)
-                       memset(&new_update, 0, sizeof(new_update));
+                       i_zero(&new_update);
                else
                        new_update = *update;
                if (guid_128_is_empty(new_update.mailbox_guid))
index 379582fc9574b67a54850256740131ae9f1658a7..74308430d063a41180101a3402fb6e9d3592ec9c 100644 (file)
@@ -172,7 +172,7 @@ notify_lookup_guid(struct mailbox_list_notify_index *inotify,
        }
 
        /* get GUID */
-       memset(status_r, 0, sizeof(*status_r));
+       i_zero(status_r);
        memset(guid_r, 0, GUID_128_SIZE);
        (void)mailbox_list_index_status(inotify->notify.list, view, seq,
                                        items, status_r, guid_r, NULL);
@@ -573,7 +573,7 @@ mailbox_list_index_notify_lookup(struct mailbox_list_notify_index *inotify,
        const char *storage_name;
        char ns_sep = mailbox_list_get_hierarchy_sep(inotify->notify.list);
 
-       memset(rec, 0, sizeof(*rec));
+       i_zero(rec);
        index_node = notify_lookup_guid(inotify, view, uid,
                                        items, status_r, rec->guid);
        if (index_node == NULL)
@@ -625,7 +625,7 @@ mailbox_list_index_notify_subscribe(struct mailbox_list_notify_index *inotify,
        struct mailbox_list_notify_rec *rec = &inotify->notify_rec;
        const char *const *vnamep;
 
-       memset(rec, 0, sizeof(*rec));
+       i_zero(rec);
        vnamep = array_idx(&inotify->new_subscriptions, idx);
        rec->vname = *vnamep;
        rec->storage_name = mailbox_list_get_storage_name(inotify->notify.list,
@@ -641,7 +641,7 @@ mailbox_list_index_notify_unsubscribe(struct mailbox_list_notify_index *inotify,
        struct mailbox_list_notify_rec *rec = &inotify->notify_rec;
        const char *const *vnamep;
 
-       memset(rec, 0, sizeof(*rec));
+       i_zero(rec);
        vnamep = array_idx(&inotify->new_unsubscriptions, idx);
        rec->vname = *vnamep;
        rec->storage_name = mailbox_list_get_storage_name(inotify->notify.list,
@@ -698,7 +698,7 @@ mailbox_list_index_notify_change(struct mailbox_list_notify_index *inotify,
                                                rec->storage_name);
        if (nnode == NULL) {
                /* mailbox didn't exist earlier - report all events as new */
-               memset(&empty_node, 0, sizeof(empty_node));
+               i_zero(&empty_node);
                nnode = &empty_node;
        }
        if (nnode->uidvalidity != status.uidvalidity)
@@ -791,7 +791,7 @@ int mailbox_list_index_notify_next(struct mailbox_list_notify *notify,
        }
        if (inotify->inbox_event_pending) {
                inotify->inbox_event_pending = FALSE;
-               memset(&inotify->notify_rec, 0, sizeof(inotify->notify_rec));
+               i_zero(&inotify->notify_rec);
                inotify->notify_rec.vname = "INBOX";
                inotify->notify_rec.storage_name = "INBOX";
                /* Don't bother trying to figure out which event exactly this
index ad1bf48549cb796c25a574eb825b66482848bfb1..1ce556cc5e144a793e6c49a3764e816bbb2d8195 100644 (file)
@@ -292,7 +292,7 @@ index_list_get_cached_first_saved(struct mailbox *box,
        uint32_t seq;
        int ret;
 
-       memset(first_saved_r, 0, sizeof(*first_saved_r));
+       i_zero(first_saved_r);
 
        if ((ret = index_list_open_view(box, TRUE, &view, &seq)) <= 0)
                return ret;
@@ -407,7 +407,7 @@ index_list_update_fill_changes(struct mailbox *box,
        struct mailbox_metadata metadata;
        uint32_t seq1, seq2;
 
-       memset(changes_r, 0, sizeof(*changes_r));
+       i_zero(changes_r);
 
        node = mailbox_list_index_lookup(box->list, box->name);
        if (node == NULL)
@@ -460,7 +460,7 @@ index_list_first_saved_update_changes(struct mailbox *box,
        mail_index_lookup_ext(list_view, changes->seq,
                              ilist->first_saved_ext_id, &data, &expunged);
        if (data == NULL)
-               memset(&first_saved, 0, sizeof(first_saved));
+               i_zero(&first_saved);
        else
                memcpy(&first_saved, data, sizeof(first_saved));
        if (mail_index_view_get_messages_count(box->view) > 0)
@@ -484,8 +484,8 @@ index_list_has_changed(struct mailbox *box, struct mail_index_view *list_view,
        struct mailbox_index_vsize old_vsize;
        guid_128_t old_guid;
 
-       memset(&old_status, 0, sizeof(old_status));
-       memset(&old_vsize, 0, sizeof(old_vsize));
+       i_zero(&old_status);
+       i_zero(&old_vsize);
        memset(old_guid, 0, sizeof(old_guid));
        (void)mailbox_list_index_status(box->list, list_view, changes->seq,
                                        CACHED_STATUS_ITEMS,
@@ -537,7 +537,7 @@ index_list_update_first_saved(struct mailbox *box,
        time_t save_date;
        int ret = 0;
 
-       memset(&first_saved, 0, sizeof(first_saved));
+       i_zero(&first_saved);
        first_saved.timestamp = (uint32_t)-1;
 
        if (changes->first_uid != 0) {
@@ -595,7 +595,7 @@ index_list_update(struct mailbox *box, struct mail_index_view *list_view,
        if (changes->msgs_changed) {
                struct mailbox_list_index_msgs_record msgs;
 
-               memset(&msgs, 0, sizeof(msgs));
+               i_zero(&msgs);
                msgs.messages = changes->status.messages;
                msgs.unseen = changes->status.unseen;
                msgs.recent = changes->status.recent;
@@ -712,7 +712,7 @@ void mailbox_list_index_update_mailbox_index(struct mailbox *box,
        bool guid_changed = FALSE;
        int ret;
 
-       memset(&changes, 0, sizeof(changes));
+       i_zero(&changes);
        if ((ret = index_list_open_view(box, TRUE, &list_view, &changes.seq)) <= 0)
                return;
 
index fdb5b0b943c1d885b2f974f0b1458840d539205a..bd7334fdb203a042f63c9f289b8acf4d74bc2955 100644 (file)
@@ -35,7 +35,7 @@ node_add_to_index(struct mailbox_list_index_sync_context *ctx,
        struct mailbox_list_index_record irec;
        uint32_t seq;
 
-       memset(&irec, 0, sizeof(irec));
+       i_zero(&irec);
        irec.name_id = node->name_id;
        if (node->parent != NULL)
                irec.parent_uid = node->parent->uid;
@@ -486,7 +486,7 @@ int mailbox_list_index_sync_delete(struct mailbox_list_index_sync_context *sync_
                i_assert(data != NULL && !expunged);
                memcpy(&rec, data, sizeof(rec));
                rec.uid_validity = 0;
-               memset(&rec.guid, 0, sizeof(rec.guid));
+               i_zero(&rec.guid);
                mail_index_update_ext(sync_ctx->trans, seq,
                                      sync_ctx->ilist->ext_id, &rec, NULL);
        }
index 9063afb2ae2b810a2998b5259848e5fa94ffc359..381d58eaa0fea5eed0c111cf8712b1e559dbf159 100644 (file)
@@ -467,7 +467,7 @@ mailbox_list_ns_prefix_return(struct ns_list_iterate_context *ctx,
        if (ns->prefix_len == 0 || !mailbox_list_ns_prefix_match(ctx, ns))
                return FALSE;
 
-       memset(&ctx->ns_info, 0, sizeof(ctx->ns_info));
+       i_zero(&ctx->ns_info);
        ctx->ns_info.ns = ns;
        ctx->ns_info.vname = p_strndup(ctx->pool, ns->prefix,
                                       ns->prefix_len-1);
@@ -906,7 +906,7 @@ static bool autocreate_iter_autobox(struct mailbox_list_iterate_context *ctx,
                ctx->autocreate_ctx;
        enum imap_match_result match;
 
-       memset(&actx->new_info, 0, sizeof(actx->new_info));
+       i_zero(&actx->new_info);
        actx->new_info.ns = ctx->list->ns;
        actx->new_info.vname = autobox->name;
        actx->new_info.flags = autobox->flags;
index b2791188a171850d723bbe34dd9543e7d4200cf9..1f2b7b65a56d17e9debe191bc5fdff2c25cfa48a 100644 (file)
@@ -26,7 +26,7 @@ mailbox_list_notify_node_get_status(struct mailbox_list_notify_tree *tree,
        if (!mail_index_lookup_seq(tree->view, nnode->index_uid, &seq))
                return;
 
-       memset(&status, 0, sizeof(status));
+       i_zero(&status);
        (void)mailbox_list_index_status(tree->list, tree->view, seq,
                STATUS_UIDVALIDITY | STATUS_UIDNEXT | STATUS_MESSAGES |
                STATUS_UNSEEN | STATUS_HIGHESTMODSEQ, &status, nnode->guid, NULL);
index 03473bad833ad4468d53e6118bfeab33937b8b66..338137f1c24ccf61f7957d238ac0c12daa2108d8 100644 (file)
@@ -204,7 +204,7 @@ void mailbox_list_subscriptions_fill(struct mailbox_list_iterate_context *ctx,
        struct mailbox_tree_iterate_context *iter;
        const char *name;
 
-       memset(&update_ctx, 0, sizeof(update_ctx));
+       i_zero(&update_ctx);
        update_ctx.iter_ctx = ctx;
        update_ctx.tree_ctx = tree;
        update_ctx.glob = ctx->glob;
index 02c8e145cd4da443563280697f229fc9f5a0b9cf..eb98815bca30719d0a79146a788860fd96854837 100644 (file)
@@ -132,7 +132,7 @@ int subsfile_set_subscribed(struct mailbox_list *list, const char *path,
        if (strcasecmp(name, "INBOX") == 0)
                name = "INBOX";
 
-       memset(&dotlock_set, 0, sizeof(dotlock_set));
+       i_zero(&dotlock_set);
        dotlock_set.use_excl_lock = mail_set->dotlock_use_excl;
        dotlock_set.nfs_flush = mail_set->mail_nfs_storage;
        dotlock_set.temp_prefix = temp_prefix;
index d596e5341abaff7364dcff6014ebcd05193c1389..47e8b63e4b1404b687ad158eb415a614c7f38315 100644 (file)
@@ -58,7 +58,7 @@ mail_search_simplify_prev_arg_hash(const struct mail_search_simplify_prev_arg *a
 static void mail_search_arg_get_base_mask(const struct mail_search_arg *arg,
                                          struct mail_search_simplify_prev_arg *mask_r)
 {
-       memset(mask_r, 0, sizeof(*mask_r));
+       i_zero(mask_r);
        mask_r->bin_mask.type = arg->type;
        mask_r->bin_mask.match_not = arg->match_not;
        mask_r->bin_mask.fuzzy = arg->fuzzy;
@@ -503,7 +503,7 @@ mail_search_args_simplify_sub(struct mailbox *box, pool_t pool,
        struct mail_search_arg *sub, **all_argsp = argsp;
        bool merged;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.parent_and = parent_and;
        ctx.pool = pool_alloconly_create("mail search args simplify", 1024);
        hash_table_create(&ctx.prev_args, ctx.pool, 0,
index 4b0b97e4abe1015b2236caa3f1a12deb5b662456..f7ea4437d3c4ac39eb5e6b245cd8b0517233cca0 100644 (file)
@@ -145,7 +145,7 @@ int mail_search_build(struct mail_search_register *reg,
        *args_r = NULL;
        *error_r = NULL;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.args = args = mail_search_build_init();
        ctx.pool = args->pool;
        ctx.reg = reg;
index 7b181d756d3415e3b8cd6a0ec7bf90450f09ab81..8079cf6d12532811ab486b7e6b2d50bc6b8febe0 100644 (file)
@@ -64,7 +64,7 @@ void mail_storage_hooks_add(struct module *module,
 {
        struct mail_storage_module_hooks new_hook;
 
-       memset(&new_hook, 0, sizeof(new_hook));
+       i_zero(&new_hook);
        new_hook.module = module;
        new_hook.hooks = hooks;
 
index 32588f1c1c75e7bea274a9ae453dadfc4947d4da..c3bf03e5ee87fd967c4355021e2cfaa789eebed3 100644 (file)
@@ -318,7 +318,7 @@ service_auth_userdb_lookup(struct mail_storage_service_ctx *ctx,
        const char *new_username;
        int ret;
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.service = input->service != NULL ? input->service :
                ctx->service->name;
        info.local_ip = input->local_ip;
@@ -440,7 +440,7 @@ mail_storage_service_get_var_expand_table(struct mail_storage_service_ctx *ctx,
 {
        struct mail_storage_service_privileges priv;
 
-       memset(&priv, 0, sizeof(priv));
+       i_zero(&priv);
        priv.uid = (uid_t)-1;
        priv.gid = (gid_t)-1;
        return get_var_expand_table(ctx->service, NULL, input, &priv);
@@ -480,7 +480,7 @@ service_parse_privileges(struct mail_storage_service_ctx *ctx,
        gid_t gid = (gid_t)-1;
        const char *error;
 
-       memset(priv_r, 0, sizeof(*priv_r));
+       i_zero(priv_r);
        if (*set->mail_uid != '\0') {
                if (!parse_uid(set->mail_uid, &uid, error_r)) {
                        *error_r = t_strdup_printf("%s (from %s)", *error_r,
@@ -986,7 +986,7 @@ int mail_storage_service_read_settings(struct mail_storage_service_ctx *ctx,
        flags = input == NULL ? ctx->flags :
                mail_storage_service_input_get_flags(ctx, input);
 
-       memset(&set_input, 0, sizeof(set_input));
+       i_zero(&set_input);
        set_input.roots = ctx->set_roots;
        set_input.preserve_user = TRUE;
        /* settings reader may exec doveconf, which is going to clear
@@ -1092,7 +1092,7 @@ mail_storage_service_load_modules(struct mail_storage_service_ctx *ctx,
        if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS) != 0)
                return 0;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.binary_name = master_service_get_name(ctx->service);
        mod_set.setting_name = "mail_plugins";
index d2e10a582e1cbdf0f4b23af7c5acd2840f778ba7..1f6cb7eef76770b4f757ba4ca7f4f7cf8afaa67e 100644 (file)
@@ -1251,7 +1251,7 @@ void mail_storage_free_binary_cache(struct mail_storage *storage)
 
        timeout_remove(&storage->binary_cache.to);
        i_stream_destroy(&storage->binary_cache.input);
-       memset(&storage->binary_cache, 0, sizeof(storage->binary_cache));
+       i_zero(&storage->binary_cache);
 }
 
 void mailbox_close(struct mailbox *box)
@@ -1400,7 +1400,7 @@ int mailbox_mark_index_deleted(struct mailbox *box, bool del)
 
 static void mailbox_close_reset_path(struct mailbox *box)
 {
-       memset(&box->_perm, 0, sizeof(box->_perm));
+       i_zero(&box->_perm);
        box->_path = NULL;
        box->_index_path = NULL;
 }
@@ -1662,7 +1662,7 @@ static void
 mailbox_get_status_set_defaults(struct mailbox *box,
                                struct mailbox_status *status_r)
 {
-       memset(status_r, 0, sizeof(*status_r));
+       i_zero(status_r);
        if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS) != 0)
                status_r->have_guids = TRUE;
        if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS) != 0)
@@ -1700,7 +1700,7 @@ void mailbox_get_open_status(struct mailbox *box,
 int mailbox_get_metadata(struct mailbox *box, enum mailbox_metadata_items items,
                         struct mailbox_metadata *metadata_r)
 {
-       memset(metadata_r, 0, sizeof(*metadata_r));
+       i_zero(metadata_r);
        if (mailbox_verify_existing_name(box) < 0)
                return -1;
 
@@ -1757,7 +1757,7 @@ int mailbox_sync_deinit(struct mailbox_sync_context **_ctx,
 
        *_ctx = NULL;
 
-       memset(status_r, 0, sizeof(*status_r));
+       i_zero(status_r);
        ret = box->v.sync_deinit(ctx, status_r);
        if (ret < 0 && box->inbox_user &&
            !box->storage->user->inbox_open_error_logged) {
@@ -2417,7 +2417,7 @@ const struct mailbox_permissions *mailbox_get_permissions(struct mailbox *box)
 
 void mailbox_refresh_permissions(struct mailbox *box)
 {
-       memset(&box->_perm, 0, sizeof(box->_perm));
+       i_zero(&box->_perm);
        (void)mailbox_get_permissions(box);
 }
 
@@ -2568,7 +2568,7 @@ int mail_parse_human_timestamp(const char *str, time_t *timestamp_r,
            i_isdigit(str[5]) && i_isdigit(str[6]) && str[7] == '-' &&
            i_isdigit(str[8]) && i_isdigit(str[9]) && str[10] == '\0') {
                /* yyyy-mm-dd */
-               memset(&tm, 0, sizeof(tm));
+               i_zero(&tm);
                tm.tm_year = (str[0]-'0') * 1000 + (str[1]-'0') * 100 +
                        (str[2]-'0') * 10 + (str[3]-'0') - 1900;
                tm.tm_mon = (str[5]-'0') * 10 + (str[6]-'0') - 1;
index c3339b31a2701192aee92b8b925db0f6b709175d..b4a091a100648018b143363250541bf1ebb30de9 100644 (file)
@@ -346,7 +346,7 @@ static int mail_user_userdb_lookup_home(struct mail_user *user)
 
        i_assert(!user->home_looked_up);
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.service = user->service;
        if (user->local_ip != NULL)
                info.local_ip = *user->local_ip;
@@ -526,7 +526,7 @@ mail_user_try_load_class_plugin(struct mail_user *user, const char *name)
        struct module *module;
        size_t name_len = strlen(name);
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.binary_name = master_service_get_name(master_service);
        mod_set.setting_name = "<built-in storage lookup>";
index 6d8e14d22f78b011868546a14511a8e116b308fb..0df7964f3b66ec76dbe7ad8da10ee4344136f37d 100644 (file)
@@ -72,7 +72,7 @@ mailbox_internal_attribute_get(enum mail_attribute_type type,
        struct mailbox_attribute_internal dreg;
        unsigned int insert_idx;
 
-       memset(&dreg, 0, sizeof(dreg));
+       i_zero(&dreg);
        dreg.type = type;       
        dreg.key = key;
 
@@ -115,7 +115,7 @@ mailbox_internal_attributes_get(enum mail_attribute_type type,
                plen--;
        }
 
-       memset(&dreg, 0, sizeof(dreg));
+       i_zero(&dreg);
        dreg.type = type;       
        dreg.key = bare_prefix;
 
@@ -207,7 +207,7 @@ int mailbox_attribute_unset(struct mailbox_transaction_context *t,
 {
        struct mail_attribute_value value;
 
-       memset(&value, 0, sizeof(value));
+       i_zero(&value);
        return mailbox_attribute_set_common(t, type, key, &value);
 }
 
@@ -317,7 +317,7 @@ int mailbox_attribute_get(struct mailbox *box,
                          struct mail_attribute_value *value_r)
 {
        int ret;
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
        if ((ret = mailbox_attribute_get_common(box, type, key,
                                value_r)) <= 0)
                return ret;
@@ -331,7 +331,7 @@ int mailbox_attribute_get_stream(struct mailbox *box,
 {
        int ret;
 
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
        value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_INT_STREAMS;
        if ((ret = mailbox_attribute_get_common(box, type, key,
                                value_r)) <= 0)
index 2f1d7f91a608d5892f7f2b6f7740b3497fb7b0d2..ac8ace99aa9560e4425c61a54556a148dedcf3f3 100644 (file)
@@ -265,7 +265,7 @@ static const char *split_next_arg(const char *const **_args)
 
 void mailbox_list_settings_init_defaults(struct mailbox_list_settings *set_r)
 {
-       memset(set_r, 0, sizeof(*set_r));
+       i_zero(set_r);
        set_r->mailbox_dir_name = "";
        set_r->maildir_name = "";
        set_r->list_index_fname = MAILBOX_LIST_INDEX_DEFAULT_PREFIX;
@@ -877,7 +877,7 @@ mailbox_list_get_permissions_internal(struct mailbox_list *list,
        const char *path, *parent_name, *parent_path, *p;
        struct stat st;
 
-       memset(permissions_r, 0, sizeof(*permissions_r));
+       i_zero(permissions_r);
 
        /* use safe defaults */
        permissions_r->file_uid = (uid_t)-1;
@@ -1588,7 +1588,7 @@ void mailbox_list_add_change(struct mailbox_list *list,
        stamp = list->changelog_timestamp != (time_t)-1 ?
                list->changelog_timestamp : ioloop_time;
 
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.type = type;
        memcpy(rec.mailbox_guid, mailbox_guid, sizeof(rec.mailbox_guid));
        mailbox_log_record_set_timestamp(&rec, stamp);
@@ -1839,8 +1839,8 @@ int mailbox_list_init_fs(struct mailbox_list *list, const char *driver,
        struct mailbox_list_fs_context *ctx;
        struct fs *parent_fs;
 
-       memset(&ssl_set, 0, sizeof(ssl_set));
-       memset(&fs_set, 0, sizeof(fs_set));
+       i_zero(&ssl_set);
+       i_zero(&fs_set);
        mail_user_init_fs_settings(list->ns->user, &fs_set, &ssl_set);
        fs_set.root_path = root_dir;
        fs_set.temp_file_prefix = mailbox_list_get_global_temp_prefix(list);
index 9b5b945f68fa40f592c19e8cd361d4f847296286..c1734e6d7e8781a429319d2e9f9d151c199f3922 100644 (file)
@@ -105,7 +105,7 @@ void buffer_create_from_data(buffer_t *buffer, void *data, size_t size)
        i_assert(sizeof(*buffer) >= sizeof(struct real_buffer));
 
        buf = (struct real_buffer *)buffer;
-       memset(buf, 0, sizeof(*buf));
+       i_zero(buf);
        buf->alloc = size;
        buf->r_buffer = buf->w_buffer = data;
        /* clear the whole memory area. unnecessary usually, but if the
@@ -123,7 +123,7 @@ void buffer_create_from_const_data(buffer_t *buffer,
        i_assert(sizeof(*buffer) >= sizeof(struct real_buffer));
 
        buf = (struct real_buffer *)buffer;
-       memset(buf, 0, sizeof(*buf));
+       i_zero(buf);
 
        buf->used = buf->alloc = size;
        buf->r_buffer = data;
index 1e058c9960157e9fe9fc9f51a88de15a1f837bc1..16eff73d7f96e4b4f59493f0e490e249c0064e2d 100644 (file)
@@ -299,7 +299,7 @@ int connection_client_connect(struct connection *conn)
 void connection_disconnect(struct connection *conn)
 {
        conn->last_input = 0;
-       memset(&conn->last_input_tv, 0, sizeof(conn->last_input_tv));
+       i_zero(&conn->last_input_tv);
        if (conn->to != NULL)
                timeout_remove(&conn->to);
        if (conn->io != NULL)
index f0ed869e14131bec64703e4194472f2661c30902..7de32237b07818121f4f6604b1fa456b3e8de84a 100644 (file)
@@ -268,7 +268,7 @@ void i_panic(const char *format, ...)
        struct failure_context ctx;
        va_list args;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.type = LOG_TYPE_PANIC;
 
        va_start(args, format);
@@ -281,7 +281,7 @@ void i_fatal(const char *format, ...)
        struct failure_context ctx;
        va_list args;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.type = LOG_TYPE_FATAL;
        ctx.exit_status = FATAL_DEFAULT;
 
@@ -295,7 +295,7 @@ void i_fatal_status(int status, const char *format, ...)
        struct failure_context ctx;
        va_list args;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.type = LOG_TYPE_FATAL;
        ctx.exit_status = status;
 
@@ -635,7 +635,7 @@ static bool line_is_ok(const char *line)
 
 void i_failure_parse_line(const char *line, struct failure_line *failure)
 {
-       memset(failure, 0, sizeof(*failure));
+       i_zero(failure);
        if (!line_is_ok(line)) {
                failure->log_type = LOG_TYPE_ERROR;
                failure->text = line;
index c5ad24a8ebc5e38ad9b9bfcd1b5c8f32ec4b1638..f7fb5fef8748cea0ed81609836b990c7b3485801 100644 (file)
@@ -53,7 +53,7 @@ void fd_debug_verify_leaks(int first_fd, int last_fd)
                        }
 
                        if (net_getpeername(fd, &raddr, &rport) < 0) {
-                               memset(&raddr, 0, sizeof(raddr));
+                               i_zero(&raddr);
                                rport = 0;
                        }
                        i_error("Leaked socket fd %d: %s:%u -> %s:%u",
index 450e6e85d8dce7e68de350f611aa71aa72f06740..0d564cef5ce97787e7847a9ca43b04048a6896a1 100644 (file)
@@ -488,7 +488,7 @@ dotlock_create(struct dotlock *dotlock, enum dotlock_create_flags flags,
                now + set->timeout;
        tmp_path = t_str_new(256);
 
-       memset(&lock_info, 0, sizeof(lock_info));
+       i_zero(&lock_info);
        lock_info.path = dotlock->path;
        lock_info.set = set;
        lock_info.lock_path = lock_path;
index 1d15df1b9d844de58355aad16bea5b8d98d09308..7953080acf8603ae7c9b13330a2c420085cb750a 100644 (file)
@@ -72,7 +72,7 @@ file_lock_find_fcntl(int lock_fd, int lock_type)
 {
        struct flock fl;
 
-       memset(&fl, 0, sizeof(fl));
+       i_zero(&fl);
        fl.l_type = lock_type;
        fl.l_whence = SEEK_SET;
        fl.l_start = 0;
index 352bba5025c254e85bff15db00cc42b551e39081..14fab267e9427338c4c30eba74428e2a97337e75 100644 (file)
@@ -93,7 +93,7 @@ int file_preallocate(int fd ATTR_UNUSED, off_t size ATTR_UNUSED)
        /* OSX */
        fstore_t fs;
 
-       memset(&fs, 0, sizeof(fs));
+       i_zero(&fs);
        fs.fst_flags = F_ALLOCATECONTIG;
        fs.fst_posmode = F_PEOFPOSMODE;
        fs.fst_offset = 0;
index 6af3f891693d4b017eb35398ac1390df7d70761b..4cbd7b0483329561f96e954f4ace34d72341dac9 100644 (file)
@@ -97,7 +97,7 @@ void io_loop_handle_add(struct io_file *io)
 
        first = ioloop_iolist_add(*list, io);
 
-       memset(&event, 0, sizeof(event));
+       i_zero(&event);
        event.data.ptr = *list;
        event.events = epoll_event_mask(*list);
 
@@ -136,7 +136,7 @@ void io_loop_handle_remove(struct io_file *io, bool closed)
        last = ioloop_iolist_del(*list, io);
 
        if (!closed) {
-               memset(&event, 0, sizeof(event));
+               i_zero(&event);
                event.data.ptr = *list;
                event.events = epoll_event_mask(*list);
 
index a0e46759a116fd22ed386ccf7a1df8afb8217db2..56550f2e1fc35f04822f1c8d5564f87c0e87b27a 100644 (file)
@@ -856,7 +856,7 @@ void io_loop_context_add_callbacks(struct ioloop_context *ctx,
 {
        struct ioloop_context_callback cb;
 
-       memset(&cb, 0, sizeof(cb));
+       i_zero(&cb);
        cb.activate = activate;
        cb.deactivate = deactivate;
        cb.context = context;
index 642d496f60404fa7be974d4e09605e0a3d201279..010bd8654da5d557c76cc9865f4fac4f116ab5c5 100644 (file)
@@ -239,7 +239,7 @@ iso8601_date_do_parse(const unsigned char *data, size_t size, struct tm *tm_r,
        struct iso8601_date_parser parser;
        time_t timestamp;
 
-       memset(&parser, 0, sizeof(parser));
+       i_zero(&parser);
        parser.cur = data;
        parser.end = data + size;
 
index 6a6438506cd62a09edd9cc46f4959221d65e3cc7..eaa6e87538aff6f32f5e70447dc28050f043bae3 100644 (file)
@@ -90,7 +90,7 @@ static ssize_t i_stream_sized_read(struct istream_private *stream)
                ret = i_stream_sized_parent_read(stream, &pos);
        }
 
-       memset(&data, 0, sizeof(data));
+       i_zero(&data);
        data.v_offset = stream->istream.v_offset;
        data.new_bytes = pos;
        data.wanted_size = sstream->size;
index 6878d6017eb936d904c12c99cc538c19133e43fd..fc5c22d49691a5201a3ef2789387086e865bfd0b 100644 (file)
@@ -882,7 +882,7 @@ i_stream_create(struct istream_private *_stream, struct istream *parent, int fd)
        if (_stream->init_buffer_size == 0)
                _stream->init_buffer_size = I_STREAM_MIN_SIZE;
 
-       memset(&_stream->statbuf, 0, sizeof(_stream->statbuf));
+       i_zero(&_stream->statbuf);
        _stream->statbuf.st_size = -1;
        _stream->statbuf.st_atime =
                _stream->statbuf.st_mtime =
index a0089afa38392a18ae3a4c5a0c2cf9f598b092af..dc8c94cc6baaf10f39ab2537b68b1bd8b2eeb230 100644 (file)
@@ -108,7 +108,7 @@ static void sig_handler(int signo)
 
        if (si == NULL) {
                /* Solaris can leave this to NULL */
-               memset(&tmp_si, 0, sizeof(tmp_si));
+               i_zero(&tmp_si);
                tmp_si.si_signo = signo;
                tmp_si.si_code = SI_NOINFO;
                si = &tmp_si;
index 8e84374015cc11ee3c94451ed8c31ee93159b5e7..9a7c24127a4d82b03dfdf91677a6f41615888140 100644 (file)
@@ -257,7 +257,7 @@ void md4_final(struct md4_context *ctx, unsigned char result[STATIC_ARRAY MD4_RE
        result[14] = ctx->d >> 16;
        result[15] = ctx->d >> 24;
 
-       safe_memset(ctx, 0, sizeof(*ctx));
+       i_zero_safe(ctx);
 }
 
 void md4_get_digest(const void *data, size_t size,
index d0920735518e39e9fd3b77010a0f9eb28f702f42..ae83860cea8910c2c4dc42e804aac05cab2101a6 100644 (file)
@@ -272,7 +272,7 @@ md5_final(struct md5_context *ctx, unsigned char result[STATIC_ARRAY MD5_RESULTL
        result[14] = ctx->d >> 16;
        result[15] = ctx->d >> 24;
 
-       safe_memset(ctx, 0, sizeof(*ctx));
+       i_zero_safe(ctx);
 }
 
 void md5_get_digest(const void *data, size_t size,
index 4af14b8596c937f49e7c181371a8f2174c8382e6..9f829529d8766fdf4e968a6ebb13b33df4492e05 100644 (file)
@@ -130,7 +130,7 @@ pool_t pool_alloconly_create(const char *name ATTR_UNUSED, size_t size)
 #endif
 
        /* create a fake alloconly_pool so we can call block_alloc() */
-       memset(&apool, 0, sizeof(apool));
+       i_zero(&apool);
        apool.pool = static_alloconly_pool;
        apool.refcount = 1;
 
index 685aab4657005b2fb424cdbaf41bcdfc96641d9c..fa05a4b1ce745da21a0ba6df93094f1f64fadce8 100644 (file)
@@ -65,7 +65,7 @@ mountpoint_get_statvfs(const char *path, pool_t pool,
 {
        struct statvfs buf;
 
-       memset(point_r, 0, sizeof(*point_r));
+       i_zero(point_r);
        if (statvfs(path, &buf) < 0) {
                if (errno == ENOENT)
                        return 0;
@@ -89,7 +89,7 @@ mountpoint_get_statvfs(const char *path, pool_t pool,
 int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r)
 {
 #ifdef MOUNTPOINT_UNKNOWN
-       memset(point_r, 0, sizeof(*point_r));
+       i_zero(point_r);
        errno = ENOSYS;
        return -1;
 #elif defined (MOUNTPOINT_STATVFS)
@@ -101,7 +101,7 @@ int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r)
        const struct mountpoint *mnt;
        struct stat st;
 
-       memset(point_r, 0, sizeof(*point_r));
+       i_zero(point_r);
        if (stat(path, &st) < 0) {
                if (errno == ENOENT)
                        return 0;
@@ -213,7 +213,7 @@ const struct mountpoint *mountpoint_iter_next(struct mountpoint_iter *iter)
        vmt_object   = vmt_base + vmt->vmt_data[VMT_OBJECT].vmt_off;
        vmt_stub     = vmt_base + vmt->vmt_data[VMT_STUB].vmt_off;
 
-       memset(&iter->mnt, 0, sizeof(iter->mnt));
+       i_zero(&iter->mnt);
        switch (vmt->vmt_gfstype) {
        case MNT_NFS:
        case MNT_NFS3:
@@ -249,7 +249,7 @@ const struct mountpoint *mountpoint_iter_next(struct mountpoint_iter *iter)
        if (iter->f == NULL)
                return NULL;
 
-       memset(&iter->mnt, 0, sizeof(iter->mnt));
+       i_zero(&iter->mnt);
        while ((getextmntent(iter->f, &ent.ext, sizeof(ent.ext))) == 0) {
                if (hasmntopt(&ent.ent, MNTOPT_IGNORE) != NULL)
                        continue;
@@ -272,7 +272,7 @@ const struct mountpoint *mountpoint_iter_next(struct mountpoint_iter *iter)
        if (iter->f == NULL)
                return NULL;
 
-       memset(&iter->mnt, 0, sizeof(iter->mnt));
+       i_zero(&iter->mnt);
        while ((ent = getmntent(iter->f)) != NULL) {
                if (strcmp(ent->mnt_type, MNTTYPE_SWAP) == 0 ||
                    strcmp(ent->mnt_type, MNTTYPE_IGNORE) == 0 ||
index 28f1499282b71593ea6503f61606a41410883580..e48436b38fc735970962b0d87443b237ca6b297c 100644 (file)
@@ -110,7 +110,7 @@ sin_get_ip(const union sockaddr_union *so, struct ip_addr *ip)
 {
        /* IP structs may be sent across processes. Clear the whole struct
           first to make sure it won't leak any data across processes. */
-       memset(ip, 0, sizeof(*ip));
+       i_zero(ip);
 
        ip->family = so->sin.sin_family;
 
@@ -120,7 +120,7 @@ sin_get_ip(const union sockaddr_union *so, struct ip_addr *ip)
        if (ip->family == AF_INET)
                memcpy(&ip->u.ip4, &so->sin.sin_addr, sizeof(ip->u.ip4));
        else
-               memset(&ip->u, 0, sizeof(ip->u));
+               i_zero(&ip->u);
 }
 
 static inline void sin_set_port(union sockaddr_union *so, in_port_t port)
@@ -153,7 +153,7 @@ static int net_connect_ip_once(const struct ip_addr *ip, in_port_t port,
        }
 
        /* create the socket */
-       memset(&so, 0, sizeof(so));
+       i_zero(&so);
         so.sin.sin_family = ip->family;
        fd = socket(ip->family, sock_type, 0);
 
@@ -244,7 +244,7 @@ int net_try_bind(const struct ip_addr *ip)
        int fd;
 
        /* create the socket */
-       memset(&so, 0, sizeof(so));
+       i_zero(&so);
         so.sin.sin_family = ip->family;
        fd = socket(ip->family, SOCK_STREAM, 0);
        if (fd == -1) {
@@ -266,7 +266,7 @@ int net_connect_unix(const char *path)
        union sockaddr_union_unix sa;
        int fd, ret;
 
-       memset(&sa, 0, sizeof(sa));
+       i_zero(&sa);
        sa.un.sun_family = AF_UNIX;
        if (i_strocpy(sa.un.sun_path, path, sizeof(sa.un.sun_path)) < 0) {
                /* too long path */
@@ -418,7 +418,7 @@ int net_listen_full(const struct ip_addr *my_ip, in_port_t *port,
        int ret, fd, opt = 1;
        socklen_t len;
 
-       memset(&so, 0, sizeof(so));
+       i_zero(&so);
        sin_set_port(&so, *port);
        sin_set_ip(&so, my_ip);
 
@@ -493,7 +493,7 @@ int net_listen_unix(const char *path, int backlog)
        } sa;
        int fd;
 
-       memset(&sa, 0, sizeof(sa));
+       i_zero(&sa);
        sa.un.sun_family = AF_UNIX;
        if (i_strocpy(sa.un.sun_path, path, sizeof(sa.un.sun_path)) < 0) {
                /* too long path */
@@ -580,7 +580,7 @@ int net_accept(int fd, struct ip_addr *addr_r, in_port_t *port_r)
        }
        if (so.sin.sin_family == AF_UNIX) {
                if (addr_r != NULL)
-                       memset(addr_r, 0, sizeof(*addr_r));
+                       i_zero(addr_r);
                if (port_r != NULL) *port_r = 0;
        } else {
                if (addr_r != NULL) sin_get_ip(&so, addr_r);
@@ -654,7 +654,7 @@ int net_gethostbyname(const char *addr, struct ip_addr **ips,
                return 0;
        }
 
-       memset(&hints, 0, sizeof(hints));
+       i_zero(&hints);
        hints.ai_socktype = SOCK_STREAM;
 
        /* save error to host_error for later use */
@@ -688,7 +688,7 @@ int net_gethostbyaddr(const struct ip_addr *ip, const char **name_r)
        char hbuf[NI_MAXHOST];
        int ret;
 
-       memset(&so, 0, sizeof(so));
+       i_zero(&so);
        sin_set_ip(&so, ip);
        ret = getnameinfo(&so.sa, addrlen, hbuf, sizeof(hbuf), NULL, 0,
                          NI_NAMEREQD);
@@ -711,7 +711,7 @@ int net_getsockname(int fd, struct ip_addr *addr, in_port_t *port)
                return -1;
        if (so.sin.sin_family == AF_UNIX) {
                if (addr != NULL)
-                       memset(addr, 0, sizeof(*addr));
+                       i_zero(addr);
                if (port != NULL) *port = 0;
        } else {
                if (addr != NULL) sin_get_ip(&so, addr);
@@ -732,7 +732,7 @@ int net_getpeername(int fd, struct ip_addr *addr, in_port_t *port)
                return -1;
        if (so.sin.sin_family == AF_UNIX) {
                if (addr != NULL)
-                       memset(addr, 0, sizeof(*addr));
+                       i_zero(addr);
                if (port != NULL) *port = 0;
        } else {
                if (addr != NULL) sin_get_ip(&so, addr);
@@ -852,9 +852,9 @@ int net_getunixcred(int fd, struct net_unix_cred *cred_r)
 
        sc = (struct sockcred *)cdata.buf;
        sc->sc_uid = sc->sc_euid = sc->sc_gid = sc->sc_egid = -1;
-       memset(&cdata.ch, 0, sizeof(cdata.ch));
+       i_zero(&cdata.ch);
 
-       memset(&msg, 0, sizeof(msg));
+       i_zero(&msg);
 
        msg.msg_iov = &iov;
        msg.msg_iovlen = 1;
index d5df233cd7f3a2d563c5cbb3d7430686ac0f8e70..63404965b2996a3c7f809321f2ed5f9f8718d707 100644 (file)
@@ -223,7 +223,7 @@ ssize_t o_stream_send(struct ostream *stream, const void *data, size_t size)
 {
        struct const_iovec iov;
 
-       memset(&iov, 0, sizeof(iov));
+       i_zero(&iov);
        iov.iov_base = data;
        iov.iov_len = size;
 
@@ -281,7 +281,7 @@ void o_stream_nsend(struct ostream *stream, const void *data, size_t size)
 {
        struct const_iovec iov;
 
-       memset(&iov, 0, sizeof(iov));
+       i_zero(&iov);
        iov.iov_base = data;
        iov.iov_len = size;
 
index 63099a41def5515fbd56f948941e33fbc7d1dbbc..5ff57f6fd94f917499309a266b5851258ce61350 100644 (file)
@@ -23,7 +23,7 @@ static char *chroot_dir = NULL;
 
 void restrict_access_init(struct restrict_access_settings *set)
 {
-       memset(set, 0, sizeof(*set));
+       i_zero(set);
 
        set->uid = (uid_t)-1;
        set->gid = (gid_t)-1;
index a47047ddd8bccd1894edb6db777583bfb9c5f83a..fd0f8bf28492fc1d1049d02017eb521d16d526b9 100644 (file)
@@ -73,7 +73,7 @@ ssize_t safe_sendfile(int out_fd, int in_fd, uoff_t *offset, size_t count)
                return 0;
        }
 
-       memset(&hdtr, 0, sizeof(hdtr));
+       i_zero(&hdtr);
        ret = sendfile(in_fd, out_fd, *offset, count, &hdtr, &sbytes, 0);
 
        *offset += sbytes;
index 0d45735fbb2a91557330846adec23456e194adbe..5239a3d3def5b8fd675b1c74b5fc8f0b9e7cef4f 100644 (file)
@@ -484,7 +484,7 @@ void seq_range_array_invert(ARRAY_TYPE(seq_range) *array,
 void seq_range_array_iter_init(struct seq_range_iter *iter_r,
                               const ARRAY_TYPE(seq_range) *array)
 {
-       memset(iter_r, 0, sizeof(*iter_r));
+       i_zero(iter_r);
        iter_r->array = array;
 }
 
index 67c4476456de7edeccf4c6caf11fd5f152e0fed1..657167850c73dca1a26b593096f9149831c33680 100644 (file)
@@ -115,14 +115,14 @@ keccakf(uint64_t s[25])
 void sha3_256_init(void *context)
 {
        struct sha3_ctx *ctx = context;
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ctx->capacityWords = 2 * 256 / (8 * sizeof(uint64_t));
 }
 
 void sha3_512_init(void *context)
 {
        struct sha3_ctx *ctx = context;
-       memset(ctx, 0, sizeof(*ctx));
+       i_zero(ctx);
        ctx->capacityWords = 2 * 512 / (8 * sizeof(uint64_t));
 }
 
index 6bedcfe150755174b2031914c0dba95db40f873d..ac9e2ca4105e46b4bf079847aaaf80257654bff2 100644 (file)
@@ -56,7 +56,7 @@ static void test_ioloop_fd(void)
                return;
        }
 
-       memset(&test_ctx, 0, sizeof(test_ctx));
+       i_zero(&test_ctx);
 
        struct ioloop *ioloop = io_loop_create();
 
index 5eb8fa7ba7aea86649e63a0fead7eed3f414873b..2d3ab260b83658d86866014f0fa997f775edd5d3 100644 (file)
@@ -39,7 +39,7 @@ void test_utc_mktime(void)
        bool success;
 
        for (i = 0; i < N_ELEMENTS(input); i++) {
-               memset(&tm, 0, sizeof(tm));
+               i_zero(&tm);
                tm.tm_year = input[i].year - 1900;
                tm.tm_mon = input[i].month - 1;
                tm.tm_mday = input[i].day;
index 604f102a3f4f5f3638353d751d9a3986df5536a6..161b7a828cbc19391db8f7569b504d2a5b97fe7b 100644 (file)
@@ -29,7 +29,7 @@ void timing_deinit(struct timing **_timing)
 
 void timing_reset(struct timing *timing)
 {
-       memset(timing, 0, sizeof(*timing));
+       i_zero(timing);
 }
 
 void timing_add_usecs(struct timing *timing, uint64_t usecs)
index e678443fe70059dc63a2a9d785feefd1bd0c6cd0..7526da0536a661960a76bd7a251677fe1d66da95 100644 (file)
@@ -649,7 +649,7 @@ uri_do_parse_host(struct uri_parser *parser,
         */
 
        if (host != NULL)
-               memset(host, 0, sizeof(*host));
+               i_zero(host);
 
        literal = uri_parser_get_tmpbuf(parser, 256);
 
@@ -739,7 +739,7 @@ uri_do_parse_authority(struct uri_parser *parser,
         */
 
        if (auth != NULL)
-               memset(auth, 0, sizeof(*auth));
+               i_zero(auth);
 
        /* Scan ahead to check whether there is a [userinfo "@"] uri component */
        for (p = parser->cur; p < parser->end; p++){
@@ -882,7 +882,7 @@ int uri_parse_path(struct uri_parser *parser,
        if (path_r != NULL)
                p_array_init(&segments, parser->pool, 16);
        else
-               memset(&segments, 0, sizeof(segments));
+               i_zero(&segments);
 
        /* check for a leading '/' and indicate absolute path
           when it is present
@@ -1165,7 +1165,7 @@ int uri_check_data(const unsigned char *data, size_t size,
        struct uri_parser parser;
        int ret;
 
-       memset(&parser, 0, sizeof(parser));
+       i_zero(&parser);
        parser.pool = pool_datastack_create();
        parser.begin = parser.cur = data;
        parser.end = data + size;
index 419db64cc2047ce3874a7c97a733548253ea673b..57577baef9d33742f6b8d4d2b6fd35a6289516c8 100644 (file)
@@ -459,7 +459,7 @@ int var_expand_with_funcs(string_t *dest, const char *str,
 
        *error_r = NULL;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        for (; *str != '\0'; str++) {
                if (*str != '%')
                        str_append_c(dest, *str);
@@ -467,7 +467,7 @@ int var_expand_with_funcs(string_t *dest, const char *str,
                        int sign = 1;
 
                        str++;
-                       memset(&ctx, 0, sizeof(ctx));
+                       i_zero(&ctx);
 
                        /* [<offset>.]<width>[<modifiers>]<variable> */
                        if (*str == '-') {
index 3cc05ea4b58e2156a36af218df3bf8ba5cf3219b..673527bf51ea59a4d5de1bab37f5de6158ac94f7 100644 (file)
@@ -179,7 +179,7 @@ static void client_read_settings(struct client *client)
        struct lda_settings *lda_set;
        const char *error;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "lmtp";
        input.local_ip = client->local_ip;
        input.remote_ip = client->remote_ip;
@@ -392,7 +392,7 @@ void client_state_reset(struct client *client, const char *state_name)
                        i_error("close(mail data fd) failed: %m");
        }
 
-       memset(&client->state, 0, sizeof(client->state));
+       i_zero(&client->state);
        p_clear(client->state_pool);
        client->state.mail_data_fd = -1;
 
index 754ad33ac61aa68450a0382df3bea064c20c2133..ccd73b039f8b6bd25e1bbee63e96c51885e5d851 100644 (file)
@@ -332,11 +332,11 @@ static bool client_proxy_rcpt(struct client *client, const char *address,
        pool_t pool;
        int ret;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "lmtp";
        mail_storage_service_init_settings(storage_service, &input);
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.service = master_service_get_name(master_service);
        info.local_ip = client->local_ip;
        info.remote_ip = client->remote_ip;
@@ -360,7 +360,7 @@ static bool client_proxy_rcpt(struct client *client, const char *address,
                }
        }
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.port = client->local_port;
        set.protocol = LMTP_CLIENT_PROTOCOL_LMTP;
        set.timeout_msecs = LMTP_PROXY_DEFAULT_TIMEOUT_MSECS;
@@ -404,7 +404,7 @@ static bool client_proxy_rcpt(struct client *client, const char *address,
        if (client->proxy == NULL) {
                struct lmtp_proxy_settings proxy_set;
 
-               memset(&proxy_set, 0, sizeof(proxy_set));
+               i_zero(&proxy_set);
                proxy_set.my_hostname = client->my_domain;
                proxy_set.dns_client_socket_path = dns_client_socket_path;
                proxy_set.session_id = client->state.session_id;
@@ -708,7 +708,7 @@ int cmd_rcpt(struct client *client, const char *args)
                                        array_count(&client->state.rcpt_to)+1);
        }
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "lmtp";
        input.username = username;
        input.local_ip = client->local_ip;
@@ -875,7 +875,7 @@ client_deliver(struct client *client, const struct mail_recipient *rcpt,
        }
        i_set_failure_prefix("%s", str_c(str));
 
-       memset(&dctx, 0, sizeof(dctx));
+       i_zero(&dctx);
        dctx.session = session;
        dctx.pool = session->pool;
        dctx.set = lda_set;
index 6477edaab58eec18111e9311e78d940a94b478b7..32bc56f563729e2ab4400cf80f4c9c5a0dba23ab 100644 (file)
@@ -135,7 +135,7 @@ lmtp_proxy_get_connection(struct lmtp_proxy *proxy,
                        return conn;
        }
 
-       memset(&client_set, 0, sizeof(client_set));
+       i_zero(&client_set);
        client_set.mail_from = proxy->mail_from;
        client_set.my_hostname = proxy->set.my_hostname;
        client_set.dns_client_socket_path = proxy->set.dns_client_socket_path;
index 4361d0096f97421b143d78edc11bd7a4e4d0f6e4..cd3d9db57471c6623879dda82e81b6690c180711 100644 (file)
@@ -46,7 +46,7 @@ static void drop_privileges(void)
        struct master_service_settings_input input;
        struct master_service_settings_output output;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "lmtp";
        input.service = "lmtp";
        (void)master_service_settings_read(master_service,
@@ -59,7 +59,7 @@ static void main_init(void)
        struct master_service_connection conn;
 
        if (IS_STANDALONE()) {
-               memset(&conn, 0, sizeof(conn));
+               i_zero(&conn);
                (void)client_create(STDIN_FILENO, STDOUT_FILENO, &conn);
        }
        dns_client_socket_path = i_strdup(t_abspath(DNS_CLIENT_SOCKET_PATH));
index a2a20de506dfb2b8836bf1ba8d52d9f6cfe861fd..797f7093f660c7594e33bffc944b31073b9663db 100644 (file)
@@ -135,7 +135,7 @@ client_log_ctx(struct log_connection *log,
        case LOG_TYPE_ERROR:
        case LOG_TYPE_FATAL:
        case LOG_TYPE_PANIC:
-               memset(&err, 0, sizeof(err));
+               i_zero(&err);
                err.type = ctx->type;
                err.timestamp = log_time->tv_sec;
                err.prefix = prefix;
@@ -156,7 +156,7 @@ client_log_fatal(struct log_connection *log, struct log_client *client,
        struct failure_context failure_ctx;
        const char *prefix = log->default_prefix;
 
-       memset(&failure_ctx, 0, sizeof(failure_ctx));
+       i_zero(&failure_ctx);
        failure_ctx.type = LOG_TYPE_FATAL;
        failure_ctx.timestamp = tm;
        failure_ctx.timestamp_usecs = log_time->tv_usec;
@@ -266,7 +266,7 @@ log_it(struct log_connection *log, const char *line,
        }
        i_assert(failure.log_type < LOG_TYPE_COUNT);
 
-       memset(&failure_ctx, 0, sizeof(failure_ctx));
+       i_zero(&failure_ctx);
        failure_ctx.type = failure.log_type;
        failure_ctx.timestamp = tm;
        failure_ctx.timestamp_usecs = log_time->tv_usec;
index 274ba3f83bf0cd71d08d06792aa35371954db818..88ebafc073104979ad474efece7c375a19b25ef3 100644 (file)
@@ -136,7 +136,7 @@ static void client_auth_parse_args(struct client *client, bool success,
        ARRAY_TYPE(const_string) alt_usernames;
 
        t_array_init(&alt_usernames, 4);
-       memset(reply_r, 0, sizeof(*reply_r));
+       i_zero(reply_r);
 
        for (; *args != NULL; args++) {
                p = strchr(*args, '=');
@@ -422,7 +422,7 @@ static int proxy_start(struct client *client,
                return -1;
        }
 
-       memset(&proxy_set, 0, sizeof(proxy_set));
+       i_zero(&proxy_set);
        proxy_set.host = reply->host;
        if (reply->hostip != NULL &&
            net_addr2ip(reply->hostip, &proxy_set.ip) < 0)
@@ -666,7 +666,7 @@ sasl_callback(struct client *client, enum sasl_server_reply sasl_reply,
                 sasl_reply == SASL_SERVER_REPLY_MASTER_FAILED);
 
        client->last_auth_fail = CLIENT_AUTH_FAIL_CODE_NONE;
-       memset(&reply, 0, sizeof(reply));
+       i_zero(&reply);
        switch (sasl_reply) {
        case SASL_SERVER_REPLY_SUCCESS:
                if (client->to_auth_waiting != NULL)
index ea38ff618bcf04dd967f545ac1ff7c2b4a48d9e2..df9775bde888dfce35f1f5ac79879b5fe65d9e47 100644 (file)
@@ -91,7 +91,7 @@ login_proxy_state_get(struct login_proxy_state *state,
 {
        struct login_proxy_record *rec, key;
 
-       memset(&key, 0, sizeof(key));
+       i_zero(&key);
        key.ip = *ip;
        key.port = port;
 
index e47fa19751ab8167ee53aa1f74bfb7b0fca1e0dd..63429febcf979d8dac57ef53ddfbdd9231b0a04f 100644 (file)
@@ -162,7 +162,7 @@ login_settings_read(pool_t pool,
        void **sets;
        unsigned int i, count;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = login_set_roots;
        input.module = login_binary->process_name;
        input.service = login_binary->protocol;
index d0e2e4c3ebc3da75951847e6f9bb9a73f097b2e5..a970e679634896dc9d5cded92fdecd327cf1e16a 100644 (file)
@@ -314,7 +314,7 @@ static void login_load_modules(void)
        if (global_login_settings->login_plugins[0] == '\0')
                return;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.binary_name = login_binary->process_name;
        mod_set.setting_name = "login_plugins";
index d01d62abb0e19ae995145686d52344ee62b9e7e9..59b6bc7a2a4bef337fc52e58619ddaf3c95fa73b 100644 (file)
@@ -124,7 +124,7 @@ static void master_send_request(struct anvil_request *anvil_request)
        buffer_t *buf;
        const char *session_id = client_get_session_id(client);
 
-       memset(&req, 0, sizeof(req));
+       i_zero(&req);
        req.auth_pid = anvil_request->auth_pid;
        req.auth_id = anvil_request->auth_id;
        req.local_ip = client->local_ip;
@@ -149,7 +149,7 @@ static void master_send_request(struct anvil_request *anvil_request)
        client->auth_finished = ioloop_time;
        client->master_auth_id = req.auth_id;
 
-       memset(&params, 0, sizeof(params));
+       i_zero(&params);
        params.client_fd = client->fd;
        params.socket_path = client->postlogin_socket_path;
        params.request = req;
@@ -350,7 +350,7 @@ void sasl_server_auth_begin(struct client *client,
                return;
        }
 
-       memset(&info, 0, sizeof(info));
+       i_zero(&info);
        info.mech = mech->name;
        info.service = service;
        info.session_id = client_get_session_id(client);
index c6bbb78e2fea0c04b8de8ac4acf02876e8b8cd74..c83109d92a7666668e02f429f6752cd087314cc6 100644 (file)
@@ -508,7 +508,7 @@ ssl_server_context_get(const struct login_settings *login_set,
 {
        struct ssl_server_context *ctx, lookup_ctx;
 
-       memset(&lookup_ctx, 0, sizeof(lookup_ctx));
+       i_zero(&lookup_ctx);
        lookup_ctx.cert = set->ssl_cert;
        lookup_ctx.key = set->ssl_key;
        lookup_ctx.ca = set->ssl_ca;
@@ -1312,7 +1312,7 @@ void ssl_proxy_init(void)
           initialized though. */
        (void)RAND_bytes(&buf, 1);
 
-       memset(&ssl_params, 0, sizeof(ssl_params));
+       i_zero(&ssl_params);
 
        ssl_proxy_count = 0;
         ssl_proxies = NULL;
index 8cd72232094449459db7fbe44df83b37c52564f3..819ddbe1c8aab711e656d00b254c4ed33ac7df72 100644 (file)
@@ -337,7 +337,7 @@ sig_settings_reload(const siginfo_t *si ATTR_UNUSED,
                }
        }
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = MASTER_SERVICE_NAME;
        input.config_path = services_get_config_socket_path(services);
@@ -410,7 +410,7 @@ static struct master_settings *master_settings_read(void)
        struct master_service_settings_output output;
        const char *error;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "master";
        input.parse_full_config = TRUE;
index 6d1eebff07c68a977abc325a3c9c3592839a24ee..a14ec7a658a8c0c23b901023e1c3514f4c3374df 100644 (file)
@@ -131,7 +131,7 @@ int sd_is_fifo(int fd, const char *path) {
         if (fd < 0)
                 return -EINVAL;
 
-        memset(&st_fd, 0, sizeof(st_fd));
+        i_zero(&st_fd);
         if (fstat(fd, &st_fd) < 0)
                 return -errno;
 
@@ -141,7 +141,7 @@ int sd_is_fifo(int fd, const char *path) {
         if (path) {
                 struct stat st_path;
 
-                memset(&st_path, 0, sizeof(st_path));
+                i_zero(&st_path);
                 if (stat(path, &st_path) < 0) {
 
                         if (errno == ENOENT || errno == ENOTDIR)
@@ -222,7 +222,7 @@ int sd_is_socket(int fd, int family, int type, int listening) {
                 union sockaddr_union sockaddr;
                 socklen_t l;
 
-                memset(&sockaddr, 0, sizeof(sockaddr));
+                i_zero(&sockaddr);
                 l = sizeof(sockaddr);
 
                 if (getsockname(fd, &sockaddr.sa, &l) < 0)
@@ -248,7 +248,7 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port
         if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
                 return r;
 
-        memset(&sockaddr, 0, sizeof(sockaddr));
+        i_zero(&sockaddr);
         l = sizeof(sockaddr);
 
         if (getsockname(fd, &sockaddr.sa, &l) < 0)
@@ -290,7 +290,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t
         if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
                 return r;
 
-        memset(&sockaddr, 0, sizeof(sockaddr));
+        i_zero(&sockaddr);
         l = sizeof(sockaddr);
 
         if (getsockname(fd, &sockaddr.sa, &l) < 0)
@@ -354,18 +354,18 @@ int sd_notify(int unset_environment, const char *state) {
                 goto finish;
         }
 
-        memset(&sockaddr, 0, sizeof(sockaddr));
+        i_zero(&sockaddr);
         sockaddr.sa.sa_family = AF_UNIX;
         strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
 
         if (sockaddr.un.sun_path[0] == '@')
                 sockaddr.un.sun_path[0] = 0;
 
-        memset(&iovec, 0, sizeof(iovec));
+        i_zero(&iovec);
         iovec.iov_base = (char*) state;
         iovec.iov_len = strlen(state);
 
-        memset(&msghdr, 0, sizeof(msghdr));
+        i_zero(&msghdr);
         msghdr.msg_name = &sockaddr;
         msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
 
index 786aa4181088a029f423e85fc972c3c3fbc10a19..48e1d1b188910fbd72af54729943884c8ac075d7 100644 (file)
@@ -260,7 +260,7 @@ static int get_socket_info(int fd, unsigned int *family, in_port_t *port)
        if (port) *port = -1;
        if (family) *family = -1;
 
-       memset(&sockaddr, 0, sizeof(sockaddr));
+       i_zero(&sockaddr);
        l = sizeof(sockaddr);
 
        if (getsockname(fd, &sockaddr.sa, &l) < 0)
index 324446f73eccf1dc46829f6081f749dc9d4f3c07..57e56341948d5c18ba8af2ea7008c97443b7baae 100644 (file)
@@ -30,7 +30,7 @@ static int service_log_fds_init(const char *log_prefix, int log_fd[2],
        fd_close_on_exec(log_fd[0], TRUE);
        fd_close_on_exec(log_fd[1], TRUE);
 
-       memset(&handshake, 0, sizeof(handshake));
+       i_zero(&handshake);
        handshake.log_magic = MASTER_LOG_MAGIC;
        handshake.prefix_len = strlen(log_prefix);
 
index 408edf4d2918566f67188ad9d14287b47e8aa300..5ccd232ef565c6b7422614facaf899f4b9fc64d9 100644 (file)
@@ -46,7 +46,7 @@ static void service_process_kill_idle(struct service_process *process)
                              dec2str(process->pid));
 
                /* assume this process is busy */
-               memset(&status, 0, sizeof(status));
+               i_zero(&status);
                service_status_more(process, &status);
                process->available_count = 0;
        } else {
index 90027e52082112303b1e8a1d421903c0288d45dc..c8cc6f8f3e38df3f2ab8dbdbd8df37de95c90db4 100644 (file)
@@ -416,7 +416,7 @@ int acl_rights_parse_line(const char *line, pool_t pool,
                        id_str = t_strdup_until(id_str, line++);
        }
 
-       memset(rights_r, 0, sizeof(*rights_r));
+       i_zero(rights_r);
 
        right_names = acl_right_names_parse(pool, line, &error);
        if (*id_str != '-')
@@ -441,7 +441,7 @@ int acl_rights_parse_line(const char *line, pool_t pool,
 void acl_rights_dup(const struct acl_rights *src,
                    pool_t pool, struct acl_rights *dest_r)
 {
-       memset(dest_r, 0, sizeof(*dest_r));
+       i_zero(dest_r);
        dest_r->id_type = src->id_type;
        dest_r->identifier = p_strdup(pool, src->identifier);
        dest_r->rights = src->rights == NULL ? NULL :
@@ -736,7 +736,7 @@ static void apply_owner_default_rights(struct acl_object *aclobj)
        struct acl_rights_update ru;
        const char *null = NULL;
 
-       memset(&ru, 0, sizeof(ru));
+       i_zero(&ru);
        ru.modify_mode = ACL_MODIFY_MODE_REPLACE;
        ru.neg_modify_mode = ACL_MODIFY_MODE_REPLACE;
        ru.rights.id_type = ACL_ID_OWNER;
@@ -767,7 +767,7 @@ void acl_object_rebuild_cache(struct acl_object *aclobj)
           ACLs are merged. In all other situations the ACLs are replaced
           (because there aren't duplicate rights entries and a user can't
           match multiple usernames). */
-       memset(&ru, 0, sizeof(ru));
+       i_zero(&ru);
        rights = array_get(&aclobj->rights, &count);
        if (!acl_backend_user_is_owner(aclobj->backend))
                i = 0;
@@ -825,7 +825,7 @@ void acl_object_remove_all_access(struct acl_object *aclobj)
        static const char *null = NULL;
        struct acl_rights rights;
 
-       memset(&rights, 0, sizeof(rights));
+       i_zero(&rights);
        rights.id_type = ACL_ID_ANYONE;
        rights.rights = &null;
        array_append(&aclobj->rights, &rights, 1);
index d8aa13f0944936bba5912168d6af4bae63a6e7e1..4e2a283d6e58437fdf5d3b91c3e5e86c3789fcbd 100644 (file)
@@ -39,7 +39,7 @@ acl_attribute_update_acl(struct mailbox_transaction_context *t, const char *key,
                                              &value_str) < 0)
                return -1;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        update.modify_mode = ACL_MODIFY_MODE_REPLACE;
        update.neg_modify_mode = ACL_MODIFY_MODE_REPLACE;
        update.last_change = value->last_change;
@@ -62,7 +62,7 @@ static int acl_attribute_get_acl(struct mailbox *box, const char *key,
        const char *id;
        int ret;
 
-       memset(value_r, 0, sizeof(*value_r));
+       i_zero(value_r);
 
        if (!box->storage->user->dsyncing) {
                mail_storage_set_error(box->storage, MAIL_ERROR_PERM,
@@ -74,7 +74,7 @@ static int acl_attribute_get_acl(struct mailbox *box, const char *key,
           can use this information) */
        (void)acl_object_last_changed(aclobj, &value_r->last_change);
 
-       memset(&wanted_rights, 0, sizeof(wanted_rights));
+       i_zero(&wanted_rights);
        id = key + strlen(MAILBOX_ATTRIBUTE_PREFIX_ACL);
        if (acl_identifier_parse(id, &wanted_rights) < 0) {
                mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,
index 0c2ebadee075bfdcec12bab877618d020f88ea47..6a355d8edba13b2b092faef5b76dd8d2ca90068b 100644 (file)
@@ -90,7 +90,7 @@ vfile_object_add_right(struct acl_object *aclobj, unsigned int idx,
                return FALSE;
        }
 
-       memset(&right, 0, sizeof(right));
+       i_zero(&right);
        right.id_type = update->rights.id_type;
        right.identifier = p_strdup(aclobj->rights_pool,
                                    update->rights.identifier);
index b0c2bbeea1585025826f5030b6a8b3283dd4847e..b6655e3933a4ab89b213ebd92added88fe243e66 100644 (file)
@@ -229,7 +229,7 @@ acl_backend_vfile_has_acl(struct acl_backend *_backend, const char *name)
        if (old_validity != NULL)
                new_validity = *old_validity;
        else
-               memset(&new_validity, 0, sizeof(new_validity));
+               i_zero(&new_validity);
 
        /* See if the mailbox exists. If we wanted recursive lookups we could
           skip this, but at least for now we assume that if an existing
@@ -558,7 +558,7 @@ static int acl_backend_vfile_object_refresh_cache(struct acl_object *_aclobj)
                p_clear(_aclobj->rights_pool);
        }
 
-       memset(&validity, 0, sizeof(validity));
+       i_zero(&validity);
        if (_aclobj->backend->global_file != NULL)
                acl_object_add_global_acls(_aclobj);
        else {
index ea8004a23ac329d81f5dd7b4be3b8a29bc9ff59d..1d1725d81a967567322edf0651196611b57eb558 100644 (file)
@@ -122,7 +122,7 @@ static int acl_global_file_read(struct acl_global_file *file)
        array_clear(&file->rights);
        p_clear(file->rights_pool);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.file = file;
        i_array_init(&ctx.parse_rights, 32);
 
index c5eae289c9aa8f5c83bc6aef9b745aa66c7fdf7c..15f443ff42bc487fcca38151e23e5b2cf11c3e8d 100644 (file)
@@ -43,7 +43,7 @@ struct acl_lookup_dict *acl_lookup_dict_init(struct mail_user *user)
        if (uri != NULL) {
                struct dict_settings dict_set;
 
-               memset(&dict_set, 0, sizeof(dict_set));
+               i_zero(&dict_set);
                dict_set.username = "";
                dict_set.base_dir = user->set->base_dir;
                if (dict_init(uri, &dict_set, &dict->dict, &error) < 0)
index 4d777d2ae4ec817be7c024077c921de9aa9d9bd9..e76fe2e47e4bd112cbdcba179a17a38f00a9d78b 100644 (file)
@@ -109,7 +109,7 @@ acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx)
                return;
 
        /* no LOOKUP right by default, we can optimize this */
-       memset(&update_ctx, 0, sizeof(update_ctx));
+       i_zero(&update_ctx);
        update_ctx.iter_ctx = &ctx->ctx;
        update_ctx.glob =
                imap_match_init(pool_datastack_create(), "*",
index 3a4f00e65130c464d88ae4e0e398b9cf61a3f9d2..fa3af8b5b39e7e8a0db6dd769e069fa14c62bf13 100644 (file)
@@ -95,7 +95,7 @@ static void acl_mailbox_copy_acls_from_parent(struct mailbox *box)
        struct acl_object_list_iter *iter;
        struct acl_rights_update update;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        update.modify_mode = ACL_MODIFY_MODE_REPLACE;
        update.neg_modify_mode = ACL_MODIFY_MODE_REPLACE;
 
index 254292e81247282a40276fd7a8d366eeca1f4777..8f99c704013eb627e4077cc2e48ff3314d4f1f14 100644 (file)
@@ -229,7 +229,7 @@ cmd_acl_set_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
        if (cmd_acl_mailbox_open(_ctx, user, mailbox, &box) < 0)
                return -1;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        update.modify_mode = ctx->modify_mode;
        update.neg_modify_mode = ctx->modify_mode;
        if (acl_rights_update_import(&update, id, rights, &error) < 0)
@@ -289,7 +289,7 @@ cmd_acl_delete_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user)
        if (cmd_acl_mailbox_open(ctx, user, mailbox, &box) < 0)
                return -1;
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        if (acl_rights_update_import(&update, id, NULL, &error) < 0)
                i_fatal_status(EX_USAGE, "%s", error);
        if ((ret = cmd_acl_mailbox_update(box, &update)) < 0) {
index 39b66ecc65401f7275edd432d89c50d9f6e13e5f..2d5244d2741e5dae19fbd17339655c8e9ccd9eca 100644 (file)
@@ -167,7 +167,7 @@ static const char *dict_ldap_map_finish(struct setting_parser_ctx *ctx)
                        return "Missing attributes for pattern variables";
        }
        array_append(&ctx->set->maps, &ctx->cur_map, 1);
-       memset(&ctx->cur_map, 0, sizeof(ctx->cur_map));
+       i_zero(&ctx->cur_map);
        return NULL;
 }
 
@@ -284,7 +284,7 @@ dict_ldap_settings_read(pool_t pool, const char *path, const char **error_r)
 {
        struct setting_parser_ctx ctx;
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.pool = pool;
        ctx.set = p_new(pool, struct dict_ldap_settings, 1);
        t_array_init(&ctx.cur_attributes, 16);
index 0fd9fd8783b794f5882b14b60feef150d88a3c1f..d728926a8e113dad1e9f173b6b5e4039a168155f 100644 (file)
@@ -151,7 +151,7 @@ static
 int dict_ldap_connect(struct ldap_dict *dict, const char **error_r)
 {
        struct ldap_client_settings set;
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.uri = dict->set->uri;
        set.bind_dn = dict->set->bind_dn;
        set.password = dict->set->password;
@@ -405,7 +405,7 @@ void ldap_dict_lookup_async(struct dict *dict, const char *key,
                op->map = map;
                attributes[0] = map->value_attribute;
                /* build lookup */
-               memset(&input, 0, sizeof(input));
+               i_zero(&input);
                input.base_dn = map->base_dn;
                input.scope = map->scope_val;
                if (!ldap_dict_build_query(ctx, map, &values, strncmp(key, DICT_PATH_PRIVATE, strlen(DICT_PATH_PRIVATE))==0, query, &error)) {
index 71e7dc06755046f5d996342fc080da78815aa2c1..4294c25c3f0d2e7e43b75a092a42e2794eadb3ad 100644 (file)
@@ -230,7 +230,7 @@ doveadm_expire_analyze_and_query(struct doveadm_mail_cmd_context *ctx,
        struct expire_query query;
        bool have_or = FALSE;
 
-       memset(&query, 0, sizeof(query));
+       i_zero(&query);
        query.before_time = (time_t)-1;
 
        for (arg = args; arg != NULL; arg = arg->next) {
@@ -409,7 +409,7 @@ static void doveadm_expire_mail_init(struct doveadm_mail_cmd_context *ctx)
        if (doveadm_debug)
                i_debug("expire: Searching only users listed in expire database");
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.value_type = DICT_DATA_TYPE_UINT32;
        dict_set.username = "";
        dict_set.base_dir = doveadm_settings->base_dir;
index c71bd0ce19ebdc3d4a9da543d7757ed0ac358234..4d11fa43b20aac147db8085b3a81004807b6a5bf 100644 (file)
@@ -165,7 +165,7 @@ expire_update(struct mailbox *box, const char *key, time_t timestamp)
        if (dict_transaction_commit(&dctx, &error) < 0)
                i_error("expire: dict commit failed: %s", error);
        else if (euser->expire_cache) {
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
                hdr.timestamp = timestamp;
 
                trans = mail_index_transaction_begin(box->view,
@@ -421,7 +421,7 @@ static void expire_mail_namespaces_created(struct mail_namespace *ns)
                return;
        }
        /* we're using only shared dictionary, the username doesn't matter. */
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.value_type = DICT_DATA_TYPE_UINT32;
        dict_set.username = "";
        dict_set.base_dir = user->set->base_dir;
index 7bb4855e313be7c556dfeb0bd81e409cfd7043ae..86bca6103b42a1402d15c33fca10daefb3c73da1 100644 (file)
@@ -21,7 +21,7 @@ static void cmd_dump_fts_lucene(int argc ATTR_UNUSED, char *argv[])
        const struct lucene_index_record *rec;
        bool first = TRUE;
 
-       memset(&prev_guid, 0, sizeof(prev_guid));
+       i_zero(&prev_guid);
        index = lucene_index_init(argv[1], NULL, NULL);
        iter = lucene_index_iter_init(index);
        while ((rec = lucene_index_iter_next(iter)) != NULL) {
index 00c382366b6df658b4002d8e9cd128ee184aa208..0b10b772e2ba2980150f22d517ac37c2c2fb73f4 100644 (file)
@@ -324,7 +324,7 @@ fts_solr_field_get(struct solr_fts_backend_update_context *ctx, const char *key)
                        return field->value;
        }
 
-       memset(&new_field, 0, sizeof(new_field));
+       i_zero(&new_field);
        new_field.key = str_lcase(i_strdup(key));
        new_field.value = str_new(default_pool, 128);
        array_append(&ctx->fields, &new_field, 1);
index 4f76f4177c5dae0a83f9ff0b55f5b6eb09686ae7..9ef058a66cbc95330f395aba0c610ce30a2d266c 100644 (file)
@@ -122,7 +122,7 @@ int solr_connection_init(const char *url, bool debug,
        conn->debug = debug;
 
        if (solr_http_client == NULL) {
-               memset(&http_set, 0, sizeof(http_set));
+               i_zero(&http_set);
                http_set.max_idle_time_msecs = 5*1000;
                http_set.max_parallel_connections = 1;
                http_set.max_pipelined_requests = 1;
@@ -425,7 +425,7 @@ int solr_connection_select(struct solr_connection *conn, const char *query,
        const char *url;
        int parse_ret;
 
-       memset(&solr_lookup_context, 0, sizeof(solr_lookup_context));
+       i_zero(&solr_lookup_context);
        solr_lookup_context.result_pool = pool;
        hash_table_create(&solr_lookup_context.mailboxes, default_pool, 0,
                          str_hash, strcmp);
index 14534026e61c56b6216821106e652e940316a54a..92cfb68953dfbed81a667a222359c6fd807a7f11 100644 (file)
@@ -174,8 +174,8 @@ static void squat_trie_close(struct squat_trie *trie)
 {
        trie->corrupted = FALSE;
        node_free(trie, &trie->root);
-       memset(&trie->root, 0, sizeof(trie->root));
-       memset(&trie->hdr, 0, sizeof(trie->hdr));
+       i_zero(&trie->root);
+       i_zero(&trie->hdr);
 
        squat_trie_close_fd(trie);
        if (trie->file_cache != NULL)
@@ -206,7 +206,7 @@ void squat_trie_set_full_len(struct squat_trie *trie, unsigned int len)
 
 static void squat_trie_header_init(struct squat_trie *trie)
 {
-       memset(&trie->hdr, 0, sizeof(trie->hdr));
+       i_zero(&trie->hdr);
        trie->hdr.version = SQUAT_TRIE_VERSION;
        trie->hdr.indexid = time(NULL);
        trie->hdr.uidvalidity = trie->uidvalidity;
@@ -1149,7 +1149,7 @@ squat_trie_iterate_next(struct squat_trie_iterate_context *ctx,
        if (shift_count != 0)
                i_array_init(&ctx->cur.shifts, shift_count);
        else
-               memset(&ctx->cur.shifts, 0, sizeof(ctx->cur.shifts));
+               i_zero(&ctx->cur.shifts);
        return squat_trie_iterate_first(ctx);
 }
 
@@ -1509,7 +1509,7 @@ static int squat_trie_map(struct squat_trie *trie, bool building)
 
        if (changed || trie->hdr.root_offset == 0) {
                node_free(trie, &trie->root);
-               memset(&trie->root, 0, sizeof(trie->root));
+               i_zero(&trie->root);
                trie->root.want_sequential = TRUE;
                trie->root.unused_uids = trie->hdr.root_unused_uids;
                trie->root.next_uid = trie->hdr.root_next_uid;
@@ -1977,7 +1977,7 @@ squat_trie_lookup_real(struct squat_trie *trie, const char *str,
        array_clear(definite_uids);
        array_clear(maybe_uids);
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.trie = trie;
        ctx.type = type;
        ctx.definite_uids = definite_uids;
index 6b48df7f40f6609fc33362e522a68af6cd4f178d..383da00448ae7c08e11517a80f3905fb492fd1a3 100644 (file)
@@ -537,7 +537,7 @@ static int squat_uidlist_open(struct squat_uidlist *uidlist)
        uidlist->fd = open(uidlist->path, O_RDWR);
        if (uidlist->fd == -1) {
                if (errno == ENOENT) {
-                       memset(&uidlist->hdr, 0, sizeof(uidlist->hdr));
+                       i_zero(&uidlist->hdr);
                        return 0;
                }
                i_error("open(%s) failed: %m", uidlist->path);
@@ -679,7 +679,7 @@ static int squat_uidlist_open_or_create(struct squat_uidlist *uidlist)
        }
        if (uidlist->locked_file_size == 0) {
                /* write using 0 until we're finished */
-               memset(&uidlist->hdr, 0, sizeof(uidlist->hdr));
+               i_zero(&uidlist->hdr);
                if (write_full(uidlist->fd, &uidlist->hdr,
                               sizeof(uidlist->hdr)) < 0) {
                        i_error("write(%s) failed: %m", uidlist->path);
@@ -718,7 +718,7 @@ int squat_uidlist_build_init(struct squat_uidlist *uidlist,
        if (ctx->output->offset == 0) {
                struct squat_uidlist_file_header hdr;
 
-               memset(&hdr, 0, sizeof(hdr));
+               i_zero(&hdr);
                o_stream_nsend(ctx->output, &hdr, sizeof(hdr));
        }
        o_stream_cork(ctx->output);
@@ -935,7 +935,7 @@ int squat_uidlist_rebuild_init(struct squat_uidlist_build_context *build_ctx,
        ctx->next_uid_list_idx = 0x100;
        o_stream_cork(ctx->output);
 
-       memset(&hdr, 0, sizeof(hdr));
+       i_zero(&hdr);
        o_stream_nsend(ctx->output, &hdr, sizeof(hdr));
 
        ctx->cur_block_start_offset = ctx->output->offset;
index cab0a1cc1bb60fdb0fb010432e92b7861e28eca9..d794f3bac0f31844df2c178fe4d2a97545189a86 100644 (file)
@@ -41,7 +41,7 @@ cmd_search_box(struct doveadm_mail_cmd_context *ctx,
                return -1;
        }
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        i_array_init(&result.definite_uids, 16);
        i_array_init(&result.maybe_uids, 16);
        i_array_init(&result.scores, 16);
index f690307966901d3aa57bd65d6e9622338157be57..adb4b065c6463315675f8363c0774f67476b53e7 100644 (file)
@@ -422,7 +422,7 @@ bool fts_index_get_header(struct mailbox *box, struct fts_index_header *hdr_r)
        mail_index_get_header_ext(view, fts_index_get_ext_id(box),
                                  &data, &data_size);
        if (data_size < sizeof(*hdr_r)) {
-               memset(hdr_r, 0, sizeof(*hdr_r));
+               i_zero(hdr_r);
                ret = FALSE;
        } else {
                memcpy(hdr_r, data, data_size);
index ad989c97a94a7da94ebf0e8c55d601ce76034061..f4442820a1504923905096c5414efee71d000178 100644 (file)
@@ -160,7 +160,7 @@ static int fts_build_mail_header(struct fts_mail_build_context *ctx,
 
        /* hdr->full_value is always set because we get the block from
           message_decoder */
-       memset(&key, 0, sizeof(key));
+       i_zero(&key);
        key.uid = ctx->mail->uid;
        key.type = block->part->physical_pos == 0 ?
                FTS_BACKEND_BUILD_KEY_HDR : FTS_BACKEND_BUILD_KEY_MIME_HDR;
@@ -222,7 +222,7 @@ fts_build_body_begin(struct fts_mail_build_context *ctx,
        i_assert(ctx->body_parser == NULL);
 
        *binary_body_r = FALSE;
-       memset(&key, 0, sizeof(key));
+       i_zero(&key);
        key.uid = ctx->mail->uid;
        key.part = part;
 
@@ -440,7 +440,7 @@ static int fts_body_parser_finish(struct fts_mail_build_context *ctx)
        int ret = 0;
 
        do {
-               memset(&block, 0, sizeof(block));
+               i_zero(&block);
                fts_parser_more(ctx->body_parser, &block);
                if (fts_build_body_block(ctx, &block, FALSE) < 0) {
                        ret = -1;
@@ -477,7 +477,7 @@ fts_build_mail_real(struct fts_backend_update_context *update_ctx,
                return -1;
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.update_ctx = update_ctx;
        ctx.mail = mail;
        if ((update_ctx->backend->flags & FTS_BACKEND_FLAG_TOKENIZED_INPUT) != 0)
index 075a46e11c3f3540c35b3f2c2704f2173f7d1e5c..616cad5700581950a214867877fb82df40eaecc9 100644 (file)
@@ -62,7 +62,7 @@ tika_get_http_client_url(struct mail_user *user, struct http_url **http_url_r)
        }
 
        if (tika_http_client == NULL) {
-               memset(&http_set, 0, sizeof(http_set));
+               i_zero(&http_set);
                http_set.max_idle_time_msecs = 100;
                http_set.max_parallel_connections = 1;
                http_set.max_pipelined_requests = 1;
index acdad40dabc8961d1104005aa79136f8cdd8c9ca..de44c84f2db7c82a9606e64eb48c9710318d8a1a 100644 (file)
@@ -41,7 +41,7 @@ static int fts_search_lookup_level_single(struct fts_search_context *fctx,
        struct fts_search_level *level;
        struct fts_result result;
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        p_array_init(&result.definite_uids, fctx->result_pool, 32);
        p_array_init(&result.maybe_uids, fctx->result_pool, 32);
        p_array_init(&result.scores, fctx->result_pool, 32);
@@ -166,7 +166,7 @@ static int fts_search_lookup_level_multi(struct fts_search_context *fctx,
                &mailboxes_arr, TRUE);
        array_sort(&mailboxes_arr, mailbox_cmp_fts_backend);
 
-       memset(&result, 0, sizeof(result));
+       i_zero(&result);
        result.pool = fctx->result_pool;
 
        level = array_append_space(&fctx->levels);
index bdc8f0da9ec65ecadd0884e363b5fc84d04db72c..48279194938233781d6af62315e8bd3edfef8ab1 100644 (file)
@@ -18,7 +18,7 @@ int main(void)
        parser = fts_parser_html.try_init(NULL, "text/html", NULL);
        i_assert(parser != NULL);
 
-       memset(&block, 0, sizeof(block));
+       i_zero(&block);
        while ((ret = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
                block.data = buf;
                block.size = ret;
index 0f0070c1c1e9d665e3f08ee2c7d370162e3895cb..2da67c2e02b0aa74ee680a52d05ebe4b8a2c7f04 100644 (file)
@@ -254,7 +254,7 @@ imap_acl_write_aclobj(string_t *dest, struct acl_backend *backend,
 
        if (!seen_positive_owner && username != NULL && add_default) {
                /* no positive owner rights returned, write default ACLs */
-               memset(&rights, 0, sizeof(rights));
+               i_zero(&rights);
                if (!convert_owner) {
                        rights.id_type = ACL_ID_OWNER;
                } else {
@@ -572,7 +572,7 @@ static bool cmd_setacl(struct client_command_context *cmd)
                return TRUE;
        }
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        if (*identifier == '-') {
                negative = TRUE;
                identifier++;
@@ -655,7 +655,7 @@ static bool cmd_deleteacl(struct client_command_context *cmd)
                return TRUE;
        }
 
-       memset(&update, 0, sizeof(update));
+       i_zero(&update);
        if (*identifier != '-')
                update.modify_mode = ACL_MODIFY_MODE_CLEAR;
        else {
index 15868534a9711446b11348cbef3c6af4d5ecad71..f30951c93c7298188578313cb3d756d4693daef9 100644 (file)
@@ -95,7 +95,7 @@ static void last_login_mail_user_created(struct mail_user *user)
        if (dict_value == NULL || dict_value[0] == '\0')
                return;
 
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.username = user->username;
        set.base_dir = user->set->base_dir;
        if (mail_user_get_home(user, &set.home_dir) <= 0)
index 4ab1b6ab37189cc31ff765f31804a6a87d72c0a4..c9350c94b1bcb476e1fa313793c8b7ed3042b1ce 100644 (file)
@@ -72,7 +72,7 @@ mcp_user_create(struct mail_user *user, const char *dest_username,
        if ((cur_ioloop_ctx = io_loop_get_current_context(current_ioloop)) != NULL)
                io_loop_context_deactivate(cur_ioloop_ctx);
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = old_input->module;
        input.service = old_input->service;
        input.username = dest_username;
@@ -446,7 +446,7 @@ static void mcp_key_list(struct mcp_cmd_context *ctx,
                struct mailbox *box =
                        mailbox_alloc(ns->list, "INBOX", MAILBOX_FLAG_READONLY);
                struct mail_attribute_value value;
-               memset(&value, 0, sizeof(value));
+               i_zero(&value);
 
                if ((ret = mailbox_attribute_get(box, MAIL_ATTRIBUTE_TYPE_SHARED,
                                                 USER_CRYPT_PREFIX
@@ -498,7 +498,7 @@ static void mcp_key_list(struct mcp_cmd_context *ctx,
                        mailbox_alloc(info->ns->list,
                                      info->vname, MAILBOX_FLAG_READONLY);
                struct mail_attribute_value value;
-               memset(&value, 0, sizeof(value));
+               i_zero(&value);
                array_clear(&ids);
 
                /* get active ID */
@@ -554,7 +554,7 @@ static int cmd_mcp_key_list_run(struct doveadm_mail_cmd_context *_ctx,
        struct mcp_cmd_context *ctx =
                (struct mcp_cmd_context *)_ctx;
        struct mcp_key_iter_ctx iter_ctx;
-       memset(&iter_ctx, 0, sizeof(iter_ctx));
+       i_zero(&iter_ctx);
        iter_ctx.pool = _ctx->pool;
        p_array_init(&iter_ctx.keys, _ctx->pool, 8);
 
@@ -767,7 +767,7 @@ static int cmd_mcp_key_password_run(struct doveadm_mail_cmd_context *_ctx,
                        dcrypt_key_unref_private(&key);
                        if (ret == -1) break;
 
-                       memset(&value, 0, sizeof(value));
+                       i_zero(&value);
                        value.value = str_c(newkey);
 
                        /* and store it */
index e61256fa238462b1c77f37177b409fa8cfb0075b..821ab38a312b9795020fdf6cd921a1bb1494440a 100644 (file)
@@ -157,7 +157,7 @@ mail_crypt_acl_user_create(struct mail_user *user, const char *dest_username,
        if ((cur_ioloop_ctx = io_loop_get_current_context(current_ioloop)) != NULL)
                io_loop_context_deactivate(cur_ioloop_ctx);
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = old_input->module;
        input.service = old_input->service;
        input.username = dest_username;
index 7ba47063e1cb5437a54413012227f445f9546be7..e5bdcaa0debae9cae2407bc63cac2927405c9977 100644 (file)
@@ -134,7 +134,7 @@ int mail_crypt_load_global_private_key(const char *set_key, const char *key_data
 
 void mail_crypt_global_keys_init(struct mail_crypt_global_keys *global_keys_r)
 {
-       memset(global_keys_r, 0, sizeof(*global_keys_r));
+       i_zero(global_keys_r);
        i_array_init(&global_keys_r->private_keys, 4);
 }
 
index 27c7ac16cf8b03039af159509ac29d62f800afbf..884d7e4a8a3b018d29461c90a997f8fa4f14fd98 100644 (file)
@@ -77,7 +77,7 @@ static void mail_crypt_cache_close(struct mail_crypt_user *muser)
                timeout_remove(&cache->to);
        if (cache->input != NULL)
                i_stream_unref(&cache->input);
-       memset(cache, 0, sizeof(*cache));
+       i_zero(cache);
 }
 
 static struct istream *
index 0ee256cb7d7e83ea4731900d7ce825ed4b84dd14..2c6215cb51fd9e730752b31a11b4477c37325121 100644 (file)
@@ -20,7 +20,7 @@ fs_crypt_load_settings(void)
        struct master_service_settings_output output;
        const char *error;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.roots = set_roots;
        input.module = "fs-crypt";
        input.service = "fs-crypt";
index d337b96ccd8ef8111b3b98eb622262f4b5b5ae29..95dfe6dbc60c9c40e8526731fa68a925a10da599 100644 (file)
@@ -55,7 +55,7 @@ static void test_try_load_keys(void)
        test_begin("try_load_keys");
 
        struct mail_crypt_global_keys keys;
-       memset(&keys, 0, sizeof(keys));
+       i_zero(&keys);
        mail_crypt_global_keys_init(&keys);
 
        const char *set_prefix = "mail_crypt_global";
@@ -103,7 +103,7 @@ static void test_empty_keyset(void)
 
        /* this should not crash */
        struct mail_crypt_global_keys keys;
-       memset(&keys, 0, sizeof(keys));
+       i_zero(&keys);
        test_assert(mail_crypt_global_key_find(&keys, "423423423423") == NULL);
 
        test_end();
index 1fc8ead8dd428d0ccf1bcdd4e388a8e43a556469..5f71b8dbcfb7507c2787c4e727a51371cfffa2ba 100644 (file)
@@ -109,7 +109,7 @@ test_mail_attribute_set(struct mailbox_transaction_context *t,
 
        int ret;
 
-       memset(&attr_value, 0, sizeof(attr_value));
+       i_zero(&attr_value);
        attr_value.value = value;
 
        if ((ret = mailbox_attribute_set(t, attr_type,
index 4c21c982238884da68b52dbacf57e4d473dd0314..a30c05121fc5e83e8ec1bfa080161870f42fd9a7 100644 (file)
@@ -182,7 +182,7 @@ int pop3_migration_get_hdr_sha1(uint32_t mail_seq, struct istream *input,
        struct sha1_ctxt sha1_ctx;
        struct pop3_hdr_context hdr_ctx;
 
-       memset(&hdr_ctx, 0, sizeof(hdr_ctx));
+       i_zero(&hdr_ctx);
        /* hide headers that might change or be different in IMAP vs. POP3 */
        input = i_stream_create_header_filter(input, HEADER_FILTER_HIDE_BODY |
                                HEADER_FILTER_EXCLUDE | HEADER_FILTER_NO_CR,
@@ -191,7 +191,7 @@ int pop3_migration_get_hdr_sha1(uint32_t mail_seq, struct istream *input,
                                pop3_header_filter_callback, &hdr_ctx);
 
        sha1_init(&sha1_ctx);
-       memset(&hash_ctx, 0, sizeof(hash_ctx));
+       i_zero(&hash_ctx);
        while (i_stream_read_more(input, &data, &size) > 0) {
                message_header_hash_more(&hash_ctx, &hash_method_sha1, &sha1_ctx, 2,
                                         data, size);
@@ -768,7 +768,7 @@ pop3_migration_get_special(struct mail *_mail, enum mail_fetch_field field,
                if (pop3_migration_uidl_sync_if_needed(_mail->box) < 0)
                        return -1;
 
-               memset(&map_key, 0, sizeof(map_key));
+               i_zero(&map_key);
                map_key.uid = _mail->uid;
                map = array_bsearch(&mbox->imap_msg_map, &map_key,
                                    imap_msg_map_uid_cmp);
index b34a6cf9f8e581034af88db2fd146cd03f12ef6b..87864af8e064dbe32e946c9def84c2663b17c158 100644 (file)
@@ -64,7 +64,7 @@ push_notification_driver_ox_init_global(struct mail_user *user,
     if (ox_global->http_client == NULL) {
         /* this is going to use the first user's settings, but these are
            unlikely to change between users so it shouldn't matter much. */
-        memset(&http_set, 0, sizeof(http_set));
+        i_zero(&http_set);
         http_set.debug = user->mail_debug;
         http_set.max_attempts = config->http_max_retries+1;
         http_set.request_timeout_msecs = config->http_timeout_msecs;
index fbe6542c094cac7a683c14c61d5c2e6b990598c5..b2812adce6e446cee8d2ab8899336c01b7d383d8 100644 (file)
@@ -18,7 +18,7 @@ static struct push_notification_event_flagsclear_config default_config;
 
 static void *push_notification_event_flagsclear_default_config(void)
 {
-    memset(&default_config, 0, sizeof(default_config));
+    i_zero(&default_config);
 
     return &default_config;
 }
index fbcb5011f7e7031bc243e6621cc6cedbbe0da87f..e458642047bb5c40aca46b167a44b142bcb89da8 100644 (file)
@@ -18,7 +18,7 @@ static struct push_notification_event_flagsset_config default_config;
 
 static void *push_notification_event_flagsset_default_config(void)
 {
-    memset(&default_config, 0, sizeof(default_config));
+    i_zero(&default_config);
 
     return &default_config;
 }
index 88afc14dbeb0bb41fcc124c42998532062a6aea8..b350bf639b542b8b9c7f04cd5d5459a4f3207161 100644 (file)
@@ -20,7 +20,7 @@ static struct push_notification_event_messageappend_config default_config;
 
 static void *push_notification_event_messageappend_default_config(void)
 {
-    memset(&default_config, 0, sizeof(default_config));
+    i_zero(&default_config);
 
     return &default_config;
 }
index 61c175906eae686294ab21b3de9c9fd0d6e67171..57c7567defe37c0a26890357271bb2b24c34648c 100644 (file)
@@ -23,7 +23,7 @@ static struct push_notification_event_messagenew_config default_config;
 
 static void *push_notification_event_messagenew_default_config(void)
 {
-    memset(&default_config, 0, sizeof(default_config));
+    i_zero(&default_config);
 
     return &default_config;
 }
index 4fbbf8786beab7accd7e2e40b3d95ffc68e3da28..265b7576f0ada86ed2224bcbc823b7c83cf1abf0 100644 (file)
@@ -198,7 +198,7 @@ static void quota_clone_mail_user_created(struct mail_user *user)
                return;
        }
 
-       memset(&dict_set, 0, sizeof(dict_set));
+       i_zero(&dict_set);
        dict_set.username = user->username;
        dict_set.base_dir = user->set->base_dir;
        (void)mail_user_get_home(user, &dict_set.home_dir);
index 4a2a1fef8d79da30cab68fa41a24efee9b3df5c8..167d7c6245c4f89b9ed78a31e2fec1c9c79bbb67 100644 (file)
@@ -99,7 +99,7 @@ cmd_quota_recalc_run(struct doveadm_mail_cmd_context *ctx ATTR_UNUSED,
                return -1;
        }
 
-       memset(&trans, 0, sizeof(trans));
+       i_zero(&trans);
        trans.quota = quser->quota;
        trans.recalculate = QUOTA_RECALCULATE_FORCED;
 
index 246c46dc589e95b477afc2098c21b6916336f479..df139bc9eaba1f5b1a4033fa40118480d647e66d 100644 (file)
@@ -264,7 +264,7 @@ static int quota_count_recalculate_box(struct mailbox *box)
        /* reset the vsize header first */
        trans = mail_index_transaction_begin(box->view,
                                MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);
-       memset(&vsize_hdr, 0, sizeof(vsize_hdr));
+       i_zero(&vsize_hdr);
        mail_index_update_header_ext(trans, box->vsize_hdr_ext_id,
                                     0, &vsize_hdr, sizeof(vsize_hdr));
        if (mail_index_transaction_commit(&trans) < 0)
index a9c1b9b29c067cf3ff7f4c1d29970aef1cf8d67a..737b09f9e7d177cd18ead447efbf31981caac5a8 100644 (file)
@@ -84,7 +84,7 @@ static int dict_quota_init(struct quota_root *_root, const char *args,
 
        /* FIXME: we should use 64bit integer as datatype instead but before
           it can actually be used don't bother */
-       memset(&set, 0, sizeof(set));
+       i_zero(&set);
        set.username = username;
        set.base_dir = _root->quota->user->set->base_dir;
        if (mail_user_get_home(_root->quota->user, &set.home_dir) <= 0)
index f2ab82ee95457d891c96d940157df11dff12f9f1..03c2dfb95098c6c96d1893e564d54851792e18a6 100644 (file)
@@ -90,7 +90,7 @@ static void client_handle_request(struct quota_client *client)
                return;
        }
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.username = client->recipient;
 
        ret = mail_storage_service_lookup_next(storage_service, &input,
@@ -197,7 +197,7 @@ static void main_init(void)
                MAIL_STORAGE_SERVICE_FLAG_ENABLE_CORE_DUMPS |
                MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR);
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.service = "quota-status";
        input.module = "mail";
        input.username = "";
index c07ea63f6426f6f7b735f0df181b185b0bbf66ea..3e509350790406c3d753a201c6d1574dafea84c1 100644 (file)
@@ -326,7 +326,7 @@ int quota_root_add_warning_rule(struct quota_root_settings *root_set,
                q = rule_def;
        }
 
-       memset(&rule, 0, sizeof(rule));
+       i_zero(&rule);
        ret = quota_rule_parse_limits(root_set, &rule, t_strdup_until(q, p),
                                      rule_def, FALSE, error_r);
        if (ret < 0)
index 1e78c83d40fa5aef43d6bbe4fd558176b4204916..8c781ba3c136b812a3997bd5561fd61b2c51451a 100644 (file)
@@ -742,7 +742,7 @@ int quota_set_resource(struct quota_root *root, const char *name,
        if (root->limit_set_dict == NULL) {
                struct dict_settings set;
 
-               memset(&set, 0, sizeof(set));
+               i_zero(&set);
                set.username = root->quota->user->username;
                set.base_dir = root->quota->user->set->base_dir;
                if (mail_user_get_home(root->quota->user, &set.home_dir) <= 0)
index 1f56e28a128f3448318b7d1999be97c0499fab32..63f9bc0dd2a0b59744b3bc6e5697a259aeb426c7 100644 (file)
@@ -56,7 +56,7 @@ static void test_quota_transaction_is_over(void)
                if (tests[i].new_size != 1)
                        continue;
 
-               memset(&ctx, 0, sizeof(ctx));
+               i_zero(&ctx);
                ctx.count_used = tests[i].transaction_diff;
                if (tests[i].initial_size > tests[i].limit)
                        ctx.count_over = tests[i].initial_size - tests[i].limit;
@@ -71,7 +71,7 @@ static void test_quota_transaction_is_over(void)
 
        test_begin("quota transcation is over (bytes)");
        for (i = 0; i < N_ELEMENTS(tests); i++) {
-               memset(&ctx, 0, sizeof(ctx));
+               i_zero(&ctx);
                ctx.count_ceil = 1;
                ctx.bytes_used = tests[i].transaction_diff;
                if (tests[i].initial_size > tests[i].limit)
index 3c8ff360e4f8fa2dedbe2a11af38af5a919f2732..a2b147740fa2eb7c76b86360933c36bfdfa7f293 100644 (file)
@@ -115,7 +115,7 @@ void mail_stats_fill(struct stats_user *suser, struct mail_stats *stats_r)
        static struct rusage prev_usage;
        struct rusage usage;
 
-       memset(stats_r, 0, sizeof(*stats_r));
+       i_zero(stats_r);
        /* cputime */
        if (getrusage(RUSAGE_SELF, &usage) < 0) {
                if (!getrusage_broken) {
index d5ed0c3b52ba0455dca8c6c55818f7ad9617f01b..72f4cabb2a06446066afd70a36d89aa7ebd368a8 100644 (file)
@@ -220,7 +220,7 @@ virtual_mailbox_get_list_patterns(struct virtual_parse_context *ctx)
        struct virtual_backend_box *const *bboxes;
        unsigned int i, count;
 
-       memset(&pattern, 0, sizeof(pattern));
+       i_zero(&pattern);
        bboxes = array_get_modifiable(&mbox->backend_boxes, &count);
        p_array_init(&mbox->list_include_patterns, ctx->pool, count);
        p_array_init(&mbox->list_exclude_patterns, ctx->pool, count);
@@ -490,7 +490,7 @@ int virtual_config_read(struct virtual_mailbox *mbox)
                return -1;
        }
 
-       memset(&ctx, 0, sizeof(ctx));
+       i_zero(&ctx);
        ctx.sep = mail_namespaces_get_root_sep(storage->user->namespaces);
        ctx.mbox = mbox;
        ctx.pool = mbox->box.pool;
index 36aa9bcfde6c326cad781c755b8561666742dbd2..627e0b4bc8394f1955159e2db883dcddd5af8798 100644 (file)
@@ -184,7 +184,7 @@ static void virtual_mail_set_seq(struct mail *mail, uint32_t seq, bool saving)
                              mbox->virtual_ext_id, &data, NULL);
        memcpy(&vmail->cur_vrec, data, sizeof(vmail->cur_vrec));
 
-       memset(&vmail->imail.data, 0, sizeof(vmail->imail.data));
+       i_zero(&vmail->imail.data);
        p_clear(vmail->imail.mail.data_pool);
 
        vmail->imail.data.seq = seq;
index 4ebc411b6ecd6c3461c4b47bf835f7113285f31a..41f7aa1b088a3096475d9bd4f4483e8f0dc62da9 100644 (file)
@@ -71,7 +71,7 @@ static void virtual_search_get_records(struct mail_search_context *ctx,
        const void *data;
        int result;
 
-       memset(&srec, 0, sizeof(srec));
+       i_zero(&srec);
        while (index_storage_search_next_update_seq(ctx)) {
                result = mail_search_get_result(ctx);
                i_assert(result != 0);
index 60e9e646d119b00cac6bf1c82b88dc1df8d0f644..b393becda5bb3a3ef109e654b96481edb6a6545d 100644 (file)
@@ -278,8 +278,8 @@ static void virtual_sync_ext_header_rewrite(struct virtual_sync_context *ctx)
        mailbox_pos = sizeof(ext_hdr);
        name_pos = mailbox_pos + sizeof(mailbox) * count;
 
-       memset(&ext_hdr, 0, sizeof(ext_hdr));
-       memset(&mailbox, 0, sizeof(mailbox));
+       i_zero(&ext_hdr);
+       i_zero(&mailbox);
 
        ext_hdr.change_counter = ++ctx->mbox->prev_change_counter;
        ext_hdr.mailbox_count = count;
@@ -489,7 +489,7 @@ static int virtual_sync_backend_box_init(struct virtual_backend_box *bbox)
                mailbox_search_result_save(search_ctx, result_flags);
 
        /* add the found UIDs to uidmap. virtual_uid gets assigned later. */
-       memset(&uidmap, 0, sizeof(uidmap));
+       i_zero(&uidmap);
        array_clear(&bbox->uids);
        while (mailbox_search_next(search_ctx, &mail)) {
                uidmap.real_uid = mail->uid;
@@ -592,7 +592,7 @@ virtual_sync_mailbox_box_add(struct virtual_sync_context *ctx,
        src = dest + add_count;
 
        /* add/move the UIDs to their correct positions */
-       memset(&rec, 0, sizeof(rec));
+       i_zero(&rec);
        rec.rec.mailbox_id = bbox->mailbox_id;
        for (i = 0; i < uid_count; i++) {
                add_uid = added_uids[i].seq1;
@@ -654,7 +654,7 @@ virtual_sync_backend_add_vmsgs_results(struct virtual_sync_context *ctx,
 
        mail_index_lookup_uid(ctx->sync_view, vseq, &vuid);
 
-       memset(&uidmap, 0, sizeof(uidmap));
+       i_zero(&uidmap);
        uidmap.real_uid = real_uid;
        uidmap.virtual_uid = vuid;
        array_append(&bbox->uids, &uidmap, 1);
@@ -1076,7 +1076,7 @@ static void virtual_sync_backend_ext_header(struct virtual_sync_context *ctx,
                return;
        }
 
-       memset(&mailbox, 0, sizeof(mailbox));
+       i_zero(&mailbox);
        mailbox.uid_validity = bbox->sync_uid_validity;
        mailbox.highest_modseq = bbox->ondisk_highest_modseq;
        mailbox.next_uid = bbox->sync_next_uid;
@@ -1245,7 +1245,7 @@ static void virtual_sync_backend_map_uids(struct virtual_sync_context *ctx)
 
        /* create real mailbox uid -> virtual uid mapping and expunge
           messages no longer matching the search rule */
-       memset(&add_rec, 0, sizeof(add_rec));
+       i_zero(&add_rec);
        bbox = NULL;
        for (i = 0; i < messages; i++) {
                vseq = vmails[i].vseq;
@@ -1313,7 +1313,7 @@ static void virtual_sync_new_backend_boxes(struct virtual_sync_context *ctx)
 
        /* if there are any mailboxes we didn't yet sync, add new messages in
           them */
-       memset(&add_rec, 0, sizeof(add_rec));
+       i_zero(&add_rec);
        bboxes = array_get(&ctx->mbox->backend_boxes, &count);
        for (i = 0; i < count; i++) {
                if (bboxes[i]->sync_seen)
@@ -1482,7 +1482,7 @@ virtual_sync_apply_existing_appends(struct virtual_sync_context *ctx)
                                         (uint32_t)-1, &seq, &seq2))
                return 0;
 
-       memset(&uidmap, 0, sizeof(uidmap));
+       i_zero(&uidmap);
        for (; seq <= seq2; seq++) {
                mail_index_lookup_ext(ctx->sync_view, seq, virtual_ext_id,
                                      &data, NULL);
index 334541a6a5ace1b99e82833ff1d608ed62283dd5..afd503bfd85064784eb44f3038a35baa0f969f14 100644 (file)
@@ -70,7 +70,7 @@ static void zlib_mail_cache_close(struct zlib_user *zuser)
                timeout_remove(&cache->to);
        if (cache->input != NULL)
                i_stream_unref(&cache->input);
-       memset(cache, 0, sizeof(*cache));
+       i_zero(cache);
 }
 
 static struct istream *
index 5d3df82ceddbd57a807397d300852ad45dd22cee..1b58ed01c6280f544c01d5006f692103a1e1aa69 100644 (file)
@@ -55,7 +55,7 @@ static int proxy_send_login(struct pop3_client *client, struct ostream *output)
        }
 
        i_assert(client->common.proxy_sasl_client == NULL);
-       memset(&sasl_set, 0, sizeof(sasl_set));
+       i_zero(&sasl_set);
        sasl_set.authid = client->common.proxy_master_user != NULL ?
                client->common.proxy_master_user : client->common.proxy_user;
        sasl_set.authzid = client->common.proxy_user;
index af195825be43a5ce8383ba7466929d0b8c26df48..adca34a286dd21ee7f079398c6633061d58a0bfa 100644 (file)
@@ -136,7 +136,7 @@ static void main_stdio_run(const char *username)
        buffer_t *input_buf;
        const char *value, *error, *input_base64;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "pop3";
        input.username = username != NULL ? username : getenv("USER");
        if (input.username == NULL && IS_STANDALONE())
@@ -165,7 +165,7 @@ login_client_connected(const struct master_login_client *client,
        const char *error;
        buffer_t input_buf;
 
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = input.service = "pop3";
        input.local_ip = client->auth_req.local_ip;
        input.remote_ip = client->auth_req.remote_ip;
@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
        const char *username = NULL, *auth_socket_path = "auth-master";
        int c;
 
-       memset(&login_set, 0, sizeof(login_set));
+       i_zero(&login_set);
        login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT;
 
        if (IS_STANDALONE() && getuid() == 0 &&
index d33fdbd04a9490b56d28de421585b00b5107fe4b..a9c4ddacee29985768eb111610dbcb302f504ed4 100644 (file)
@@ -19,7 +19,7 @@ void replicator_queue_add_auth_users(struct replicator_queue *queue,
        auth_conn = auth_master_init(auth_socket_path,
                                     AUTH_MASTER_FLAG_NO_IDLE_TIMEOUT);
 
-       memset(&user_info, 0, sizeof(user_info));
+       i_zero(&user_info);
        user_info.service = REPLICATOR_AUTH_SERVICE_NAME;
 
        /* add all users into replication queue, so that we can start doing
index 383c059eb86e432765dda2596b7c64e1476fedea..0e9e34736a4fc4fd14a5a91ed8212cc928addbae 100644 (file)
@@ -310,7 +310,7 @@ replicator_queue_import_line(struct replicator_queue *queue, const char *line)
        if (str_array_length(args) < 7)
                return -1;
 
-       memset(&tmp_user, 0, sizeof(tmp_user));
+       i_zero(&tmp_user);
        username = args[0];
        state = t_strdup_noconst(args[6]);
        if (username[0] == '\0' ||
index 3b9521190b9be71083a7b39ce35bad851ad4b657..583058ae897a9c62310bdad533cc8ffce9b17dfa 100644 (file)
@@ -70,7 +70,7 @@ mail_export_parse_filter(const char *const *args, pool_t pool,
           since=<timestamp>
           connected
        */
-       memset(filter_r, 0, sizeof(*filter_r));
+       i_zero(filter_r);
        for (; *args != NULL; args++) {
                if (strncmp(*args, "user=", 5) == 0)
                        filter_r->user = p_strdup(pool, *args + 5);
index 4b19c757df14b5f4857adbc40e57243d525e2992..6f00b61dc893e3caec3bde1c83961de866180a49 100644 (file)
@@ -15,7 +15,7 @@ int client_stats_reset(struct client *client, const char *const *args ATTR_UNUSE
        g->num_logins = 0;
        g->num_cmds = 0;
        g->reset_timestamp = ioloop_time;
-       memset(&(g->last_update), 0, sizeof(g->last_update));
+       i_zero(&g->last_update);
        o_stream_nsend_str(client->output, "OK\n");
        return 0;
 }
index c731d548501ce0f5f3955476ba2902f8dac52cc1..f5d85b2d8d64a6d6dcd4991046fe5fe6fa2e20c6 100644 (file)
@@ -31,7 +31,7 @@ static void main_preinit(void)
 {
        struct module_dir_load_settings mod_set;
 
-       memset(&mod_set, 0, sizeof(mod_set));
+       i_zero(&mod_set);
        mod_set.abi_version = DOVECOT_ABI_VERSION;
        mod_set.require_init_funcs = TRUE;
 
index 91ca89993bf24de30718d0dca2c48caa0cb5fb17..9c50a3ae34ebb6ad0bf9852d1fb9e561f467cea3 100644 (file)
@@ -89,7 +89,7 @@ static void client_connected(struct master_service_connection *conn)
                i_fatal("Missing input fields");
 
        i = 0;
-       memset(&input, 0, sizeof(input));
+       i_zero(&input);
        input.module = "mail"; /* need to get mail_uid, mail_gid */
        input.service = "script-login";
        (void)net_addr2ip(args[i++], &input.local_ip);