No need to add 1 to arg passed to ds_extend(), because the argument
[pspp] / src / libpspp / str.c
index c8497c34af4fbf1dd57ace97d18d1ad72e60116c..c4ce9c512b74a94a919dc06aff46d9983b5b5c38 100644 (file)
@@ -681,6 +681,21 @@ ds_concat (struct string *st, const char *buf, size_t len)
   st->length += len;
 }
 
+/* Returns ds_end(ST) and THEN increases the length by INCR. */
+char *
+ds_append_uninit(struct string *st, size_t incr)
+{
+  char *end;
+
+  ds_extend(st, ds_length(st) + incr);
+
+  end = ds_end(st);
+
+  st->length += incr;
+  return end;
+}
+
 /* Formats FORMAT as a printf string and appends the result to ST. */
 void
 ds_printf (struct string *st, const char *format, ...)