dovecot-2.1: var_expand*(): Allow table to be NULL (when using o...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 2 15:45:35 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/56c3a6c1d187
changeset: 14055:56c3a6c1d187
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 02 15:44:51 2012 +0200
description:
var_expand*(): Allow table to be NULL (when using only func_table).
diffstat:
src/lib/var-expand.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (31 lines):
diff -r ab58022f934f -r 56c3a6c1d187 src/lib/var-expand.c
--- a/src/lib/var-expand.c Thu Feb 02 15:28:10 2012 +0200
+++ b/src/lib/var-expand.c Thu Feb 02 15:44:51 2012 +0200
@@ -162,11 +162,13 @@
const struct var_expand_table *t;
const char *value = NULL;
- for (t = table; !TABLE_LAST(t); t++) {
- if (t->long_key != NULL &&
- strncmp(t->long_key, key_start, key_len) == 0 &&
- t->long_key[key_len] == '\0') {
- return t->value != NULL ? t->value : "";
+ if (table != NULL) {
+ for (t = table; !TABLE_LAST(t); t++) {
+ if (t->long_key != NULL &&
+ strncmp(t->long_key, key_start, key_len) == 0 &&
+ t->long_key[key_len] == '\0') {
+ return t->value != NULL ? t->value : "";
+ }
}
}
@@ -287,7 +289,7 @@
str+1, len, context);
if (var != NULL)
str = end;
- } else {
+ } else if (table != NULL) {
for (t = table; !TABLE_LAST(t); t++) {
if (t->key == *str) {
var = t->value != NULL ?
More information about the dovecot-cvs
mailing list