From 9925408af038a7cd93a6edae47e5b39fc1d05c2e Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 28 Nov 2014 14:42:25 +0900 Subject: [PATCH] msgfilter: Simplify the last commit * msgfilter.c (prepare_read): Simplify the last commit 06e206f5, by always adding 1 to the buffer size. --- gettext-tools/src/ChangeLog | 5 +++++ gettext-tools/src/msgfilter.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) 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; -- 2.47.3