From: Daiki Ueno Date: Fri, 28 Nov 2014 05:42:25 +0000 (+0900) Subject: msgfilter: Simplify the last commit X-Git-Tag: v0.19.4~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9925408af038a7cd93a6edae47e5b39fc1d05c2e;p=thirdparty%2Fgettext.git msgfilter: Simplify the last commit * msgfilter.c (prepare_read): Simplify the last commit 06e206f5, by always adding 1 to the buffer size. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 1fdff820e..e45bbc5f8 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2014-11-28 Daiki Ueno + + * msgfilter.c (prepare_read): Simplify the last commit 06e206f5, + by always adding 1 to the buffer size. + 2014-11-28 Daiki Ueno msgfilter: Fix read buffer allocation for empty input diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index 5daced43e..f9cb1cc28 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -554,8 +554,7 @@ prepare_read (size_t *num_bytes_p, void *private_data) if (l->length == l->allocated) { - l->allocated = l->allocated - + (l->allocated < 2 ? 1 : (l->allocated >> 1)); + l->allocated = l->allocated + (l->allocated >> 1) + 1; l->result = (char *) xrealloc (l->result, l->allocated); } *num_bytes_p = l->allocated - l->length;