]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: var-expand: Removed var_expand_table_build().
authorStephan Bosch <stephan@dovecot.fi>
Sun, 28 Aug 2016 22:03:54 +0000 (00:03 +0200)
committerGitLab <gitlab@git.dovecot.net>
Thu, 1 Sep 2016 10:53:27 +0000 (13:53 +0300)
Replaced it with explicit table construction at the one place it was used.
Clang -Wvargargs complained about passing a char argument to va_start().

src/auth/userdb-vpopmail.c
src/lib/var-expand.c
src/lib/var-expand.h

index 45eeafc5966d53deed1f8828719684e8db5f9533..dd2fcfa55027b664a0a9271a0d843129a04b6102 100644 (file)
@@ -61,7 +61,10 @@ userdb_vpopmail_get_quota(const char *template, const char *vpop_str)
            strcmp(vpop_str, "NOQUOTA") == 0)
                return "";
 
-       tab = var_expand_table_build('q', format_maildirquota(vpop_str), '\0');
+       tab = t_new(struct var_expand_table, 2);
+       tab[0].key = 'q';
+       tab[0].value = format_maildirquota(vpop_str);
+
        quota = t_str_new(128);
        var_expand(quota, template, tab);
        return str_c(quota);
index b4093ada427c0cd3b435b78c500e391a64095e25..0b7fd24984098a8dafaeab9714a512aa9d2def72 100644 (file)
@@ -484,30 +484,3 @@ bool var_has_key(const char *str, char key, const char *long_key)
        }
        return FALSE;
 }
-
-const struct var_expand_table *
-var_expand_table_build(char key, const char *value, char key2, ...)
-{
-       ARRAY(struct var_expand_table) variables;
-       struct var_expand_table *var;
-       va_list args;
-
-       i_assert(key != '\0');
-
-       t_array_init(&variables, 16);
-       var = array_append_space(&variables);
-       var->key = key;
-       var->value = value;
-
-       va_start(args, key2);
-       for (key = key2; key != '\0'; key = va_arg(args, int)) {
-               var = array_append_space(&variables);
-               var->key = key;
-               var->value = va_arg(args, const char *);
-       }
-       va_end(args);
-
-       /* 0, NULL entry */
-       array_append_zero(&variables);
-       return array_idx(&variables, 0);
-}
index ccaaeac9f33a9745c426f8fa3093cd095a30cb2f..aea8d77b33cc41c6f5b9415f2b3851693d8d8912 100644 (file)
@@ -36,7 +36,4 @@ void var_get_key_range(const char *str, unsigned int *idx_r,
    If key is '\0', it's ignored. If long_key is NULL, it's ignored. */
 bool var_has_key(const char *str, char key, const char *long_key) ATTR_PURE;
 
-const struct var_expand_table *
-var_expand_table_build(char key, const char *value, char key2, ...);
-
 #endif