From 7dc0dcc86cfceecf53be9e88619885935ec40f8a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 2 May 2006 22:46:00 +0000 Subject: [PATCH 1/1] No need to add 1 to arg passed to ds_extend(), because the argument does not include space for a null terminator. Also, fix warning. --- src/libpspp/ChangeLog | 6 ++++++ src/libpspp/str.c | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index b3c5b065..6375857a 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,9 @@ +Tue May 2 15:41:50 2006 Ben Pfaff + + * str.c (ds_append_uninit): No need to add 1 to arg passed to + ds_extend(), because the argument does not include space for a + null terminator. Also, fix warning. + Tue Apr 25 11:07:19 2006 Ben Pfaff Finish reforming error message support. In this phase, move diff --git a/src/libpspp/str.c b/src/libpspp/str.c index 613ecbc5..c4ce9c51 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -681,14 +681,13 @@ 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 */ +/* Returns ds_end(ST) and THEN increases the length by INCR. */ char * ds_append_uninit(struct string *st, size_t incr) { - char *end ; - assert(incr >= 0 ); + char *end; - ds_extend(st, ds_length(st) + incr + 1); + ds_extend(st, ds_length(st) + incr); end = ds_end(st); -- 2.30.2