X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/4fab92fbc2b63bac2d89c1dae69fa1845cb640b7..d9cb3c4537f82c8663c19c391bd727235916db6c:/src/src/lookups/lsearch.c diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c index 6101d00ac..8b4459ad1 100644 --- a/src/src/lookups/lsearch.c +++ b/src/src/lookups/lsearch.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ #include "../exim.h" @@ -101,11 +101,10 @@ for (last_was_eol = TRUE; Ufgets(buffer, sizeof(buffer), f) != NULL; last_was_eol = this_is_eol) { - int ptr, size; int p = Ustrlen(buffer); int linekeylength; BOOL this_is_comment; - uschar *yield; + gstring * yield; uschar *s = buffer; /* Check whether this the final segment of a line. If it follows an @@ -240,7 +239,7 @@ for (last_was_eol = TRUE; /* Reset dynamic store, if we need to, and revert to the search pool */ - if (reset_point != NULL) + if (reset_point) { store_reset(reset_point); store_pool = old_pool; @@ -254,11 +253,9 @@ for (last_was_eol = TRUE; Initialize, and copy the first segment of data. */ this_is_comment = FALSE; - size = 100; - ptr = 0; - yield = store_get(size); + yield = string_get(100); if (*s != 0) - yield = string_cat(yield, &size, &ptr, s); + yield = string_cat(yield, s); /* Now handle continuations */ @@ -294,18 +291,17 @@ for (last_was_eol = TRUE; /* Join a physical or logical line continuation onto the result string. */ - yield = string_cat(yield, &size, &ptr, s); + yield = string_cat(yield, s); } - yield[ptr] = 0; - store_reset(yield + ptr + 1); - *result = yield; + store_reset(yield->s + yield->ptr + 1); + *result = string_from_gstring(yield); return OK; } /* Reset dynamic store, if we need to */ -if (reset_point != NULL) +if (reset_point) { store_reset(reset_point); store_pool = old_pool;