From: Ben Pfaff Date: Tue, 2 May 2006 22:46:00 +0000 (+0000) Subject: No need to add 1 to arg passed to ds_extend(), because the argument X-Git-Tag: sav-api~1918 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7dc0dcc86cfceecf53be9e88619885935ec40f8a;p=pspp 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. --- diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index b3c5b065b9..6375857a66 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 613ecbc545..c4ce9c512b 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);