[dovecot-cvs] dovecot/src/lib var-expand.c, 1.14, 1.15 var-expand.h, 1.3, 1.4
tss at dovecot.org
tss at dovecot.org
Sat Mar 31 17:04:31 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv20762
Modified Files:
var-expand.c var-expand.h
Log Message:
Added var_expand_table_build()
Index: var-expand.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/var-expand.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- var-expand.c 12 Nov 2006 12:06:36 -0000 1.14
+++ var-expand.c 31 Mar 2007 14:04:28 -0000 1.15
@@ -1,6 +1,7 @@
/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
+#include "array.h"
#include "md5.h"
#include "hash.h"
#include "hex-binary.h"
@@ -266,3 +267,30 @@
return *str;
}
+
+const struct var_expand_table *
+var_expand_table_build(char key, const char *value, char key2, ...)
+{
+ ARRAY_DEFINE(variables, struct var_expand_table);
+ 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 */
+ (void)array_append_space(&variables);
+ return array_idx(&variables, 0);
+}
Index: var-expand.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/var-expand.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- var-expand.h 15 Dec 2004 19:31:06 -0000 1.3
+++ var-expand.h 31 Mar 2007 14:04:28 -0000 1.4
@@ -15,4 +15,7 @@
that are before it. The string should be the data after the '%' character. */
char var_get_key(const char *str);
+const struct var_expand_table *
+var_expand_table_build(char key, const char *value, char key2, ...);
+
#endif
More information about the dovecot-cvs
mailing list