]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
treewide sparse cleanup - make single-unit-only data static
authorPhil Carmody <phil@dovecot.fi>
Tue, 6 May 2014 15:10:55 +0000 (18:10 +0300)
committerPhil Carmody <phil@dovecot.fi>
Tue, 6 May 2014 15:10:55 +0000 (18:10 +0300)
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').

src/lib-index/mail-index-strmap.c
src/lib-lda/mail-send.c
src/lib-storage/mail-search-register-imap.c
src/lib/child-wait.c
src/lib/hash-method.c
src/login-common/client-common.c
src/plugins/fts-lucene/doveadm-fts-lucene.c
src/plugins/fts/doveadm-dump-fts-expunge-log.c
src/plugins/fts/fts-parser-html.c
src/plugins/fts/fts-parser.c

index 5877ac682a3b66986a74d875392db68762ba8940..76a5d16bca3bfe89159201543791e5bdb8b4f6fc 100644 (file)
@@ -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
 };
index 6c81497066e2884fdfbe0456795c584e9d6d9ac5..c7cd15ddebe1bf704e9266d035e3659157bf7f65 100644 (file)
@@ -21,8 +21,6 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 
-int global_outgoing_count = 0;
-
 static const struct var_expand_table *
 get_var_expand_table(struct mail *mail, const char *reason,
                     const char *recipient)
index d9f981feeabfc2b9aadd81f70b76d782487acf77..60e6b663f1334be72ebb9f783eb06d34a0292668 100644 (file)
@@ -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 },
index 2a067cfb32879a6d384c445a4298e0d7c52ba3b2..7fea1a33834b6198399f7806d69fcf8dc38eb07c 100644 (file)
@@ -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 *
index 2f896e0c910a4f5abcd042c9dac93a1dc36292d8..52b8ae9b1e2b5566365b4871542825cf249ec97f 100644 (file)
@@ -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),
index e882eb43f88cc0e5480df0aa45e3d136862e2d96..6cebce97955f9aa74e6de7b634a26ee455ba38e1 100644 (file)
@@ -25,7 +25,8 @@
 
 #include <stdlib.h>
 
-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)
index f13c0da4e1f959f16234bf688110205ec228c7c5..6c631022caf2f6759c4bb22d8be9e4c8c1865677 100644 (file)
@@ -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
index 85ca0067e80a9008c71e408d43d64adfc98b7b95..94e679035299bd5690a0aa373904aee0ff324579 100644 (file)
@@ -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
index 3e4446c81a97a7436f5c38e392a937f54a7e769b..53363b50b6c3442ab2c4e11132629b90ef16f95e 100644 (file)
@@ -36,7 +36,7 @@ struct html_fts_parser {
        bool ignore_next_text;
 };
 
-struct {
+static struct {
        const char *name;
        unichar_t chr;
 } html_entities[] = {
index f9da5a77c8a472b01db2722fc6128d3dd1a3a953..c60d0df8fc2c7a9d6c9ab85520a4886312894e56 100644 (file)
@@ -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