* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 2017 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* Miscellaneous string-handling functions. Some are not required for
/* Handle the case when a buffer is provided. */
-if (buffer != NULL)
+if (buffer)
{
int p = 0;
for (; *s != 0; s++)
}
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 */
return g->s;
}
+void
+gstring_reset_unused(gstring * g)
+{
+store_reset(g->s + (g->size = g->ptr + 1));
+}
+
/*************************************************
* Add chars to string *
*************************************************/