[exim-cvs] Make def:<var> compatible between "static" and "d…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Make def:<var> compatible between "static" and "dynamic" vars.
Gitweb: https://git.exim.org/exim.git/commitdiff/6b5b7e0caf05fae77569061d2487e7de9bcfda75
Commit:     6b5b7e0caf05fae77569061d2487e7de9bcfda75
Parent:     7ae71ad1ec1fe9ab2aff04efc277b7427f933ea9
Author:     Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Tue May 26 12:28:43 2020 +0200
Committer:  Heiko Schlittermann (HS12-RIPE) <hs@???>
CommitDate: Tue May 26 14:59:06 2020 +0200


    Make def:<var> compatible between "static" and "dynamic" vars.


    Some variables are simple pointers to internal memory (e.g.
    vtype_stringptr), other variables are dynamically filled with content
    (e.g. vtype_string_func).


    The static variables contain "" if they're not defined yet.
    At least on dynamic variable (recipients, backed by fn_recipients())
    returned NULL instead of "", which lead to unexpected results on
    def:recipients.


    To keep the functions usable in places where it makes sense to return
    NULL and "" as distinct values, I didn't touch the functions, but the
    evaluation logic in find_variable().
---
 src/src/expand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff --git a/src/src/expand.c b/src/src/expand.c
index 2c29c26..26f7f10 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -2066,7 +2066,8 @@ switch (vp->type)
   case vtype_string_func:
     {
     stringptr_fn_t * fn = (stringptr_fn_t *) val;
-    return fn();
+    uschar* s = fn();
+    return s ? s : US"";
     }


case vtype_pspace: