]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use "static const" for all struct tests[] arrays
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 23 Dec 2016 15:57:16 +0000 (17:57 +0200)
committerGitLab <gitlab@git.dovecot.net>
Fri, 23 Dec 2016 16:30:55 +0000 (18:30 +0200)
34 files changed:
src/auth/test-auth-cache.c
src/lib-charset/test-charset.c
src/lib-dcrypt/test-crypto.c
src/lib-dns/test-dns-util.c
src/lib-fts/test-fts-filter.c
src/lib-fts/test-fts-tokenizer.c
src/lib-imap/test-imap-quote.c
src/lib-imap/test-imap-utf7.c
src/lib-index/test-mail-index-modseq.c
src/lib-mail/test-istream-header-filter.c
src/lib-mail/test-mail-html2text.c
src/lib-mail/test-message-snippet.c
src/lib-mail/test-rfc822-parser.c
src/lib-settings/test-settings-parser.c
src/lib-storage/test-mail-search-args-imap.c
src/lib-storage/test-mail-search-args-simplify.c
src/lib/test-hash-format.c
src/lib/test-ioloop.c
src/lib/test-istream-base64-decoder.c
src/lib/test-istream-base64-encoder.c
src/lib/test-json-parser.c
src/lib/test-lib.c
src/lib/test-malloc-overflow.c
src/lib/test-net.c
src/lib/test-numpack.c
src/lib/test-seq-range-array.c
src/lib/test-str-sanitize.c
src/lib/test-strescape.c
src/lib/test-strfuncs.c
src/lib/test-time-util.c
src/lib/test-utc-mktime.c
src/lib/test-var-expand.c
src/lib/test-wildcard-match.c
src/plugins/pop3-migration/test-pop3-migration-plugin.c

index 134dad4850bf1bfc7e8e3cb94e4c05a9f42ea991..db8cde048ae0e5206dbbc3276c7daa0ca0767060 100644 (file)
@@ -31,7 +31,7 @@ int t_auth_request_var_expand(const char *str,
 
 static void test_auth_cache_parse_key(void)
 {
-       struct {
+       static const struct {
                const char *in, *out;
        } tests[] = {
                { "%n@%d", "%u" },
index 1f76373768569b94d510f96f733ce11e8c93cfdc..72146b019b559685b054545167ae78f67dd591cd 100644 (file)
@@ -17,7 +17,7 @@ static void test_charset_is_utf8(void)
 
 static void test_charset_utf8_common(const char *input_charset)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
                enum charset_result result;
@@ -60,7 +60,7 @@ static void test_charset_utf8(void)
 #ifdef HAVE_ICONV
 static void test_charset_iconv(void)
 {
-       struct {
+       static const struct {
                const char *charset;
                const char *input;
                const char *output;
@@ -110,7 +110,7 @@ static void test_charset_iconv(void)
 }
 static void test_charset_iconv_crashes(void)
 {
-       struct {
+       static const struct {
                const char *charset;
                const char *input;
        } tests[] = {
index 47a4cfe760bf14032a0454107cb9ad79ae269a9b..6ef14a65b34e7450ace656d04c381f4a813838e9 100644 (file)
@@ -20,7 +20,7 @@
 static
 void test_cipher_test_vectors(void)
 {
-       static struct {
+       static const struct {
                const char *key;
                const char *iv;
                const char *pt;
index bb7787941397fd8646335b7d3b1e5ec450957b8a..febc17b3c6d6f71bdbdeeb87a945186f57d2eb35 100644 (file)
@@ -7,7 +7,7 @@
 
 static void test_dns_compare(void)
 {
-       struct {
+       static const struct {
                const char *a;
                const char *b;
                int res;
@@ -44,7 +44,7 @@ static void test_dns_compare(void)
 
 static void test_dns_match(void)
 {
-       struct {
+       static const struct {
                const char *name;
                const char *mask;
                int res;
index dc001f2160ebb9ea25c516e966d82d97a644f07b..c741c8921bc4397544f7879565807bcb2f210935 100644 (file)
@@ -44,7 +44,7 @@ static void test_fts_filter_contractions_fail(void)
 
 static void test_fts_filter_contractions_fr(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
        } tests[] = {
@@ -92,7 +92,7 @@ static void test_fts_filter_contractions_fr(void)
 
 static void test_fts_filter_lowercase(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
        } tests[] = {
@@ -120,7 +120,7 @@ static void test_fts_filter_lowercase(void)
 #ifdef HAVE_LIBICU
 static void test_fts_filter_lowercase_utf8(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
        } tests[] = {
@@ -147,7 +147,7 @@ static void test_fts_filter_lowercase_utf8(void)
 
 static void test_fts_filter_lowercase_too_long_utf8(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
        } tests[] = {
index 467dac0973988bfd8c6b3b0317bdaa564fa3d4a7..29fe2178d7bb726e7da9442878fc9ad0da2352e2 100644 (file)
@@ -428,7 +428,7 @@ static void test_fts_tokenizer_address_search(void)
 
 static void test_fts_tokenizer_delete_trailing_partial_char(void)
 {
-       const struct {
+       static const struct {
                const char *str;
                unsigned int truncated_len;
        } tests[] = {
index 70e0dfdd3df0f6bdf323bcb3340f519005b66b28..5470a275e87cb4b84ac4756e6d2fa760d67efa94 100644 (file)
@@ -7,7 +7,7 @@
 
 static void test_imap_append_string_for_humans(void)
 {
-       static struct {
+       static const struct {
                const char *input, *output;
        } tests[] = {
                { "", "\"\"" },
@@ -39,7 +39,7 @@ static void test_imap_append_string_for_humans(void)
 
 static void test_imap_append_astring(void)
 {
-       static struct {
+       static const struct {
                const char *input, *output;
        } tests[] = {
                { "", "\"\"" },
@@ -80,7 +80,7 @@ static void test_imap_append_astring(void)
 
 static void test_imap_append_nstring(void)
 {
-       static struct {
+       static const struct {
                const char *input, *output;
        } tests[] = {
                { "", "\"\"" },
index 2a535b1867a160ff8f898f6d6fc93a76b275e57b..2108a5e7b474b7240cd4eb894e16deb25fa6c04c 100644 (file)
@@ -8,7 +8,7 @@
 
 static void test_imap_utf7_by_example(void)
 {
-       static struct test {
+       static const struct test {
                const char *utf8;
                const char *mutf7;
        } tests[] = {
index 9a211ace34676751790194b7f2e86c63d71189ea..da1d639cf3e20113f24838809d810cff2a9c2965 100644 (file)
@@ -12,7 +12,7 @@
 
 static void test_mail_index_modseq_get_next_log_offset(void)
 {
-       struct {
+       static const struct {
                uint32_t log_seq;
                uoff_t log_offset;
        } tests[] = {
index 9d3a58d38b8149dab1bc66cc19e051a972c5e6e1..84ef54b089ee81b8942ee240e4d43f8cdd85011a 100644 (file)
@@ -449,7 +449,7 @@ static void test_istream_end_body_with_lf(void)
 
 static void test_istream_add_missing_eoh(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
                unsigned int extra;
@@ -482,7 +482,7 @@ static void test_istream_add_missing_eoh(void)
 
 static void test_istream_hide_body(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *output;
                int extra;
index ebdf201d3596fdecb8b17ee8640b9084bff6827b..596d98610b659d024cfa4f0beef94eba81a217a4 100644 (file)
@@ -6,7 +6,7 @@
 #include "mail-html2text.h"
 #include "test-common.h"
 
-static struct {
+static const struct {
        const char *input;
        const char *output;
 } tests[] = {
index 2fae35f1d174f75c79a2e0c20c19607f73d7d00c..e4c6ca3deac41c75b4a2e569857a6d02670e738a 100644 (file)
@@ -6,7 +6,7 @@
 #include "message-snippet.h"
 #include "test-common.h"
 
-static struct {
+static const struct {
        const char *input;
        unsigned int max_snippet_chars;
        const char *output;
index e42e1f4ed82a35b633bebecd651846c85c81ad40..e38a33faa6344eef9b0ad2dbe16b5162c12beb6c 100644 (file)
@@ -7,7 +7,7 @@
 
 static void test_rfc822_parse_quoted_string(void)
 {
-       const struct {
+       static const struct {
                const char *input, *output;
                int ret;
        } tests[] = {
index 75d7d0ad86fb105feff1bf2df009a18ae1bb8b49..f970fe9137bf65d29f0b4500662742805a059348 100644 (file)
@@ -6,7 +6,7 @@
 
 static void test_settings_get_time(void)
 {
-       struct {
+       static const struct {
                const char *input;
                unsigned int output;
        } tests[] = {
index 28ef245c5eddf5e619ace27eb96051e2d7e352ec..1ae757058d3d991704f3464b3fe58708aa75984f 100644 (file)
@@ -10,7 +10,7 @@
 
 #define CURRENT_UNIX_TIME 1000000
 
-static struct {
+static const struct {
        const char *input, *output;
 } tests[] = {
        { "ALL", NULL },
index e3cb422da2e1a3b4da182b797ea8880ac367bb81..0db48800a22b8b8e79df032a29ec604ab9034c24 100644 (file)
@@ -7,7 +7,7 @@
 #include "mail-search-parser.h"
 #include "mail-search.h"
 
-struct {
+static const struct {
        const char *input;
        const char *output;
 } tests[] = {
index 568b577db91b85d6e0adf8d158cc71463bc07f94..275a43ef1f792485e15d57a8337b25a2e090b9f5 100644 (file)
@@ -21,7 +21,7 @@ void test_hash_format(void)
                "%{sha1:168}",
                NULL
        };
-       static struct hash_format_test tests[] = {
+       static const struct hash_format_test tests[] = {
                { "%{sha1}", "8843d7f92416211de9ebb963ff4ce28125932878" },
                { "*%{sha1}*", "*8843d7f92416211de9ebb963ff4ce28125932878*" },
                { "*%{sha1:8}*", "*88*" },
index 68f8dfabebf50afeff1a097a9a15eac194833b94..6bedcfe150755174b2031914c0dba95db40f873d 100644 (file)
@@ -133,7 +133,7 @@ static void io_callback(void *context ATTR_UNUSED)
 
 static void test_ioloop_find_fd_conditions(void)
 {
-       struct {
+       static struct {
                enum io_condition condition;
                int fd[2];
                struct io *io;
index ffdab55a262c018c3f6b1ec27bba56239782732a..e46b8c4bb70bb4ed9e72434699db009a81c78474 100644 (file)
@@ -5,7 +5,7 @@
 #include "istream-private.h"
 #include "istream-base64.h"
 
-struct {
+static const struct {
        const char *input;
        const char *output;
 } tests[] = {
index e158078d1b4e7828e2d29cb7657be2aeaa0df50d..c6937471bb1b57b2bc2b273a7e9e5b2ed95fff25 100644 (file)
@@ -5,7 +5,7 @@
 #include "istream-private.h"
 #include "istream-base64.h"
 
-static struct test {
+static const struct test {
        const char *input;
        unsigned int chars_per_line;
        bool crlf;
index 5b58eacb11d8d98039f241b64ffc0687cf4db7f6..e54a1b3026cbc1e913796bbd1a6b4b8deb6e6e77 100644 (file)
@@ -32,7 +32,7 @@ static const char json_input[] =
        "\"key12\": [ \"foo\" , 5.24,[true],{\"aobj\":[]}]"
        "}\n";
 
-static struct {
+static const struct {
        enum json_type type;
        const char *value;
 } json_output[] = {
@@ -212,7 +212,7 @@ test_json_parse_input(const char *test_input, enum json_parser_flags flags)
 
 static void test_json_parser_primitive_values(void)
 {
-       static struct {
+       static const struct {
                const char *str;
                int ret;
        } test_inputs[] = {
index 5c0017f4c2b240b3ad389fad5d2468f78c58fc17..f541772c771e012f36921af444bef63bfa120806 100644 (file)
@@ -8,7 +8,7 @@ int main(int argc, char **argv)
        if (argc > 2 && strcmp(argv[1], "--match") == 0)
                match = argv[2];
 
-       static struct named_test test_functions[] = {
+       static const struct named_test test_functions[] = {
 #define TEST(x) TEST_NAMED(x)
 #define FATAL(x)
 #include "test-lib.inc"
@@ -16,7 +16,7 @@ int main(int argc, char **argv)
 #undef FATAL
                { NULL, NULL }
        };
-       static struct named_fatal fatal_functions[] = {
+       static const struct named_fatal fatal_functions[] = {
 #define TEST(x)
 #define FATAL(x) FATAL_NAMED(x)
 #include "test-lib.inc"
index 1add5aa399c5bee8279c216e5b0bd0334d4e0623..04cf64dddf4bc0f12ced89e0e930821ec609cde9 100644 (file)
@@ -4,7 +4,7 @@
 
 static void test_malloc_overflow_multiply(void)
 {
-       const struct {
+       static const struct {
                size_t a, b;
        } tests[] = {
                { 0, SIZE_MAX },
@@ -21,7 +21,7 @@ static void test_malloc_overflow_multiply(void)
 
 static void test_malloc_overflow_add(void)
 {
-       const struct {
+       static const struct {
                size_t a, b;
        } tests[] = {
                { 0, SIZE_MAX },
index ef584e894861bc29585c35980b52d31e846165c7..fb48701deafb8ffde963449c3d7a04d3b4b26168 100644 (file)
@@ -12,7 +12,7 @@ struct test_net_is_in_network_input {
 
 static void test_net_is_in_network(void)
 {
-       static struct test_net_is_in_network_input input[] = {
+       static const struct test_net_is_in_network_input input[] = {
                { "1.2.3.4", "1.2.3.4", 32, TRUE },
                { "1.2.3.4", "1.2.3.3", 32, FALSE },
                { "1.2.3.4", "1.2.3.5", 32, FALSE },
index f35d865a5b447eeed272c34916cd24e11f1fe9ef..0fd41aef5fe592ea6a1d6774fce458c912dab499 100644 (file)
@@ -5,7 +5,7 @@
 #include "numpack.h"
 
 
-static struct test {
+static const struct test {
        uint64_t input;
        uint8_t output[10];
        unsigned int output_size;
@@ -19,7 +19,7 @@ static struct test {
        { 0xffffffffffffffff, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 1 }, 10 },
        { 0xfffffffe, { 0xfe, 0xff, 0xff, 0xff, 0xf }, 5 },
 };
-static struct fail {
+static const struct fail {
        uint8_t input[11];
        unsigned int input_size;
 } dec_fails[] = {
index 2d9f23c0f7b04a1383821aae35f95bb4fb951f61..a67c7aa31d37ab21858f720f7d1603f06eab2ab2 100644 (file)
@@ -213,7 +213,7 @@ static void test_seq_range_array_invert(void)
 
 static void test_seq_range_array_invert_edges(void)
 {
-       const struct {
+       static const struct {
                int64_t a_seq1, a_seq2, b_seq1, b_seq2;
                int64_t resa_seq1, resa_seq2, resb_seq1, resb_seq2;
        } tests[] = {
index 1d912f426b901c611ccb5e2f4e723cd54241f4b6..2c1b8dc20ee2cf32e507affb39c0ffaf76c98cab 100644 (file)
@@ -12,7 +12,7 @@ struct str_sanitize_test {
 
 void test_str_sanitize(void)
 {
-       static struct str_sanitize_test tests[] = {
+       static const struct str_sanitize_test tests[] = {
                { NULL,    2, NULL },
                { "",      2, NULL },
                { "a",     2, NULL },
index 4c1e291aa43a398af4e18a44e4cc274698311915..7aa023fa9159a2894b85a1d9e81b76de95253a24 100644 (file)
@@ -17,12 +17,12 @@ static const char *wrong_tabescaped_output = "a\001b\nc\001\t\r\nplip\n";
 
 static void test_str_escape(void)
 {
-       static struct strinput unesc[] = {
+       static const struct strinput unesc[] = {
                { "foo", "foo" },
                { "\\\\\\\\\\\"\\\"\\\'\\\'", "\\\\\"\"\'\'" },
                { "\\a\\n\\r\\", "anr" }
        };
-       static struct strinput tabesc[] = {
+       static const struct strinput tabesc[] = {
                { "foo", "foo" },
                { "\001", "\0011" },
                { "\t", "\001t" },
index 8f53b246a0594db3823414a0263de895bf733cd4..f46d51036e85efc40090fbde35a558aa5973b631 100644 (file)
@@ -122,7 +122,7 @@ static void test_t_str_rtrim(void)
 static const char *const test_strarray_input[] = {
        "", "hello", "world", "", "yay", "", NULL
 };
-static struct {
+static const struct {
        const char *separator;
        const char *output;
 } test_strarray_outputs[] = {
index 9dfd5735855b8c7407604eb45c44fd623d0eb992..3834db66983f951b3adff267b1784f3a7baf8e4e 100644 (file)
@@ -7,7 +7,7 @@
 
 static void test_timeval_cmp(void)
 {
-       static struct timeval input[] = {
+       static const struct timeval input[] = {
                { 0, 0 }, { 0, 0 },
                { INT_MAX, 999999 }, { INT_MAX, 999999 },
                { 0, 0 }, { 0, 1 },
@@ -37,7 +37,7 @@ static void test_timeval_cmp(void)
 
 static void test_timeval_diff(void)
 {
-       static struct timeval input[] = {
+       static const struct timeval input[] = {
                { 1, 0 }, { 0, 999999 },
                { 1, 0 }, { 0, 999001 },
                { 1, 1 }, { 0, 999001 },
index 6a9893dd99816fba4ea5088d44877809f700ba2c..5eb8fa7ba7aea86649e63a0fead7eed3f414873b 100644 (file)
@@ -9,7 +9,7 @@ struct test_utc_mktime_input {
 
 void test_utc_mktime(void)
 {
-       static struct test_utc_mktime_input input[] = {
+       static const struct test_utc_mktime_input input[] = {
 #ifdef TIME_T_SIGNED
                { 1969, 12, 31, 23, 59, 59 },
                { 1901, 12, 13, 20, 45, 53 },
index a1d17c6c8db2cf6c0f27218a2e589244e15e1112..641467e0499c590b8a5826e8c52f54dbf6c11aff 100644 (file)
@@ -19,7 +19,7 @@ struct var_get_key_range_test {
 
 static void test_var_expand_ranges(void)
 {
-       static struct var_expand_test tests[] = {
+       static const struct var_expand_test tests[] = {
                { "%v", "value1234", 1 },
                { "%3v", "val", 1 },
                { "%3.2v", "ue", 1 },
@@ -28,7 +28,7 @@ static void test_var_expand_ranges(void)
                { "%0.-1v", "value123", 1 },
                { "%-4.-1v", "123", 1 }
        };
-       static struct var_expand_table table[] = {
+       static const struct var_expand_table table[] = {
                { 'v', "value1234", NULL },
                { '\0', NULL, NULL }
        };
@@ -59,7 +59,7 @@ static void test_var_expand_builtin(void)
                { "%{nonexistent}", "UNSUPPORTED_VARIABLE_nonexistent", 0 },
                { "%{nonexistent:default}", "UNSUPPORTED_VARIABLE_nonexistent", 0 },
        };
-       static struct var_expand_table table[] = {
+       static const struct var_expand_table table[] = {
                { 'v', "value", NULL },
                { 'w', "value2", NULL },
                { '\0', NULL, NULL }
@@ -83,7 +83,7 @@ static void test_var_expand_builtin(void)
 
 static void test_var_get_key_range(void)
 {
-       static struct var_get_key_range_test tests[] = {
+       static const struct var_get_key_range_test tests[] = {
                { "", 0, 0 },
                { "{", 1, 0 },
                { "k", 0, 1 },
@@ -153,7 +153,7 @@ static int test_var_expand_func5(const char *data ATTR_UNUSED,
 
 static void test_var_expand_with_funcs(void)
 {
-       static struct var_expand_test tests[] = {
+       static const struct var_expand_test tests[] = {
                { "%{func1}", "<>", 1 },
                { "%{func1:foo}", "<foo>", 1 },
                { "%{func2}", "", 1 },
@@ -163,7 +163,7 @@ static void test_var_expand_with_funcs(void)
                { "%{func4}%{func5}", "", -1 },
                { "%{func5}%{func4}%{func3}", "", -1 },
        };
-       static struct var_expand_table table[] = {
+       static const struct var_expand_table table[] = {
                { '\0', NULL, NULL }
        };
        static const struct var_expand_func_table func_table[] = {
@@ -190,7 +190,7 @@ static void test_var_expand_with_funcs(void)
 
 static void test_var_get_key(void)
 {
-       static struct {
+       static const struct {
                const char *str;
                char key;
        } tests[] = {
@@ -210,7 +210,7 @@ static void test_var_get_key(void)
 
 static void test_var_has_key(void)
 {
-       static struct {
+       static const struct {
                const char *str;
                char key;
                const char *long_key;
@@ -247,13 +247,13 @@ static void test_var_expand_hashing(void)
        const char *error;
        test_begin("var_expand_hashing");
 
-       static struct var_expand_table table[] = {
+       static const struct var_expand_table table[] = {
                {'\0', "example", "value" },
                {'\0', "other-example", "other-value" },
                {'\0', NULL, NULL}
        };
 
-       static struct {
+       static const struct {
                const char *in;
                const char *out;
        } tests[] = {
index f2f20de40b7722243e45486ad60006f0569e5030..384e73fe89a817751b42ddea9149a9741a0f6b3f 100644 (file)
@@ -3,7 +3,7 @@
 #include "test-lib.h"
 #include "wildcard-match.h"
 
-static struct {
+static const struct {
        const char *data;
        const char *mask;
        bool result;
index a102a8f359b7678276bbf3777c7e2a64d860e4a1..dfd60d5c5623ada945cabae10d6abc8b0215290e 100644 (file)
@@ -9,7 +9,7 @@
 
 static void test_pop3_migration_get_hdr_sha1(void)
 {
-       struct {
+       static const struct {
                const char *input;
                const char *sha1;
                bool have_eoh;