ARC initial implementation. Experimental. Bug 2162
[exim.git] / src / src / string.c
index 50442bced5e052542ed087abf02bfb81d2ae0718..29a87c57233f832f20be1264420bb79abc3fec46 100644 (file)
@@ -914,7 +914,7 @@ sep_is_special = iscntrl(sep);
 
 /* Handle the case when a buffer is provided. */
 
-if (buffer != NULL)
+if (buffer)
   {
   int p = 0;
   for (; *s != 0; s++)
@@ -960,6 +960,7 @@ else
     }
   while (g->ptr > 0 && isspace(g->s[g->ptr-1])) g->ptr--;
   buffer = string_from_gstring(g);
+  gstring_reset_unused(g);
   }
 
 /* Update the current pointer and return the new string */
@@ -1073,6 +1074,12 @@ g->s[g->ptr] = '\0';
 return g->s;
 }
 
+void
+gstring_reset_unused(gstring * g)
+{
+store_reset(g->s + (g->size = g->ptr + 1));
+}
+
 /*************************************************
 *             Add chars to string                *
 *************************************************/