[exim-cvs] Expansions: Reduce memory use of ${listcount }

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Expansions: Reduce memory use of ${listcount }
Gitweb: https://git.exim.org/exim.git/commitdiff/71c8c2ef07fabc64c4b56b6eee1eeffb88a8f5e0
Commit:     71c8c2ef07fabc64c4b56b6eee1eeffb88a8f5e0
Parent:     60236d8a7bbccd9f73b39525b2dc54528c0de22a
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Dec 24 21:05:40 2020 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Dec 24 21:05:40 2020 +0000


    Expansions: Reduce memory use of ${listcount }
---
 src/src/expand.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


diff --git a/src/src/expand.c b/src/src/expand.c
index 37276dd..8be7bf9 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -7324,10 +7324,10 @@ while (*s)

       case EOP_LISTCOUNT:
         {
-    int cnt = 0;
-    int sep = 0;
+    int cnt = 0, sep = 0;
+    uschar * buf = store_get(2, is_tainted(sub));


-    while (string_nextinlist(CUSS &sub, &sep, NULL, 0)) cnt++;
+    while (string_nextinlist(CUSS &sub, &sep, buf, 1)) cnt++;
     yield = string_fmt_append(yield, "%d", cnt);
         continue;
         }