From: Phil Carmody Date: Tue, 6 May 2014 15:10:55 +0000 (+0300) Subject: treewide sparse cleanup - make single-unit-only data static X-Git-Tag: 2.2.13.rc1~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b3e92b6043435c5aa9f1cf1d04b632f3e19abd9;p=thirdparty%2Fdovecot%2Fcore.git treewide sparse cleanup - make single-unit-only data static Helps keep the global namespace clean. Not all the things suggested by sparse have been moved. All DOVECOT_ABI_VERSION strings, and anything replicated in all-settings.c by src/config/settings-get.pl has been left untouched. Some of the latter could be moved, but the script would need to be modified to replicate the 'static' (it outputs 'extern'). --- diff --git a/src/lib-index/mail-index-strmap.c b/src/lib-index/mail-index-strmap.c index 5877ac682a..76a5d16bca 100644 --- a/src/lib-index/mail-index-strmap.c +++ b/src/lib-index/mail-index-strmap.c @@ -89,7 +89,7 @@ struct mail_index_strmap_hash_key { #define MAIL_INDEX_STRMAP_TIMEOUT_SECS 10 -const struct dotlock_settings default_dotlock_settings = { +static const struct dotlock_settings default_dotlock_settings = { .timeout = MAIL_INDEX_STRMAP_TIMEOUT_SECS, .stale_timeout = 30 }; diff --git a/src/lib-lda/mail-send.c b/src/lib-lda/mail-send.c index 6c81497066..c7cd15ddeb 100644 --- a/src/lib-lda/mail-send.c +++ b/src/lib-lda/mail-send.c @@ -21,8 +21,6 @@ #include #include -int global_outgoing_count = 0; - static const struct var_expand_table * get_var_expand_table(struct mail *mail, const char *reason, const char *recipient) diff --git a/src/lib-storage/mail-search-register-imap.c b/src/lib-storage/mail-search-register-imap.c index d9f981feea..60e6b663f1 100644 --- a/src/lib-storage/mail-search-register-imap.c +++ b/src/lib-storage/mail-search-register-imap.c @@ -501,7 +501,7 @@ imap_search_x_mailbox(struct mail_search_build_context *ctx) return sarg; } -const struct mail_search_register_arg imap_register_args[] = { +static const struct mail_search_register_arg imap_register_args[] = { /* argument set operations */ { "NOT", imap_search_not }, { "OR", imap_search_or }, diff --git a/src/lib/child-wait.c b/src/lib/child-wait.c index 2a067cfb32..7fea1a3383 100644 --- a/src/lib/child-wait.c +++ b/src/lib/child-wait.c @@ -15,7 +15,7 @@ struct child_wait { }; /* pid_t => wait */ -HASH_TABLE(void *, struct child_wait *) child_pids; +static HASH_TABLE(void *, struct child_wait *) child_pids; #undef child_wait_new_with_pid struct child_wait * diff --git a/src/lib/hash-method.c b/src/lib/hash-method.c index 2f896e0c91..52b8ae9b1e 100644 --- a/src/lib/hash-method.c +++ b/src/lib/hash-method.c @@ -47,7 +47,7 @@ static void hash_method_result_size(void *context, unsigned char *result_r) result_r[7] = (*ctx & 0x00000000000000ffULL); } -const struct hash_method hash_method_size = { +static const struct hash_method hash_method_size = { "size", sizeof(uint64_t), sizeof(uint64_t), diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index e882eb43f8..6cebce9795 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -25,7 +25,8 @@ #include -struct client *clients = NULL, *last_client = NULL; +struct client *clients = NULL; +static struct client *last_client = NULL; static unsigned int clients_count = 0; static void client_idle_disconnect_timeout(struct client *client) diff --git a/src/plugins/fts-lucene/doveadm-fts-lucene.c b/src/plugins/fts-lucene/doveadm-fts-lucene.c index f13c0da4e1..6c631022ca 100644 --- a/src/plugins/fts-lucene/doveadm-fts-lucene.c +++ b/src/plugins/fts-lucene/doveadm-fts-lucene.c @@ -53,7 +53,7 @@ static bool test_dump_fts_lucene(const char *path) return stat(path, &st) == 0; } -struct doveadm_cmd_dump doveadm_cmd_dump_fts_lucene = { +static const struct doveadm_cmd_dump doveadm_cmd_dump_fts_lucene = { "fts-lucene", test_dump_fts_lucene, cmd_dump_fts_lucene diff --git a/src/plugins/fts/doveadm-dump-fts-expunge-log.c b/src/plugins/fts/doveadm-dump-fts-expunge-log.c index 85ca0067e8..94e6790352 100644 --- a/src/plugins/fts/doveadm-dump-fts-expunge-log.c +++ b/src/plugins/fts/doveadm-dump-fts-expunge-log.c @@ -97,7 +97,7 @@ static bool test_dump_fts_expunge_log(const char *path) return strcmp(p, "dovecot-expunges.log") == 0; } -struct doveadm_cmd_dump doveadm_cmd_dump_fts_expunge_log = { +static const struct doveadm_cmd_dump doveadm_cmd_dump_fts_expunge_log = { "fts-expunge-log", test_dump_fts_expunge_log, cmd_dump_fts_expunge_log diff --git a/src/plugins/fts/fts-parser-html.c b/src/plugins/fts/fts-parser-html.c index 3e4446c81a..53363b50b6 100644 --- a/src/plugins/fts/fts-parser-html.c +++ b/src/plugins/fts/fts-parser-html.c @@ -36,7 +36,7 @@ struct html_fts_parser { bool ignore_next_text; }; -struct { +static struct { const char *name; unichar_t chr; } html_entities[] = { diff --git a/src/plugins/fts/fts-parser.c b/src/plugins/fts/fts-parser.c index f9da5a77c8..c60d0df8fc 100644 --- a/src/plugins/fts/fts-parser.c +++ b/src/plugins/fts/fts-parser.c @@ -6,7 +6,7 @@ #include "message-parser.h" #include "fts-parser.h" -const struct fts_parser_vfuncs *parsers[] = { +static const struct fts_parser_vfuncs *parsers[] = { &fts_parser_html, &fts_parser_script, &fts_parser_tika