1From dfc801c44a93bed7b3951905b188823d6a0432c8 Mon Sep 17 00:00:00 2001 2From: Sergey Poznyakoff <gray@gnu.org> 3Date: Wed, 11 Aug 2021 18:10:38 +0300 4Subject: Fix previous commit 5 6* src/dstring.c (ds_reset,ds_concat): Don't call ds_resize in a 7loop. 8 9[Retrieved from: 10https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=dfc801c44a93bed7b3951905b188823d6a0432c8] 11Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 12--- 13 src/dstring.c | 4 ++-- 14 1 file changed, 2 insertions(+), 2 deletions(-) 15 16diff --git a/src/dstring.c b/src/dstring.c 17index 692d3e7..b7e0bb5 100644 18--- a/src/dstring.c 19+++ b/src/dstring.c 20@@ -64,7 +64,7 @@ void 21 ds_reset (dynamic_string *s, size_t len) 22 { 23 while (len > s->ds_size) 24- ds_resize (s); 25+ s->ds_string = x2nrealloc (s->ds_string, &s->ds_size, 1); 26 s->ds_idx = len; 27 } 28 29@@ -116,7 +116,7 @@ ds_concat (dynamic_string *s, char const *str) 30 { 31 size_t len = strlen (str); 32 while (len + 1 > s->ds_size) 33- ds_resize (s); 34+ s->ds_string = x2nrealloc (s->ds_string, &s->ds_size, 1); 35 memcpy (s->ds_string + s->ds_idx, str, len); 36 s->ds_idx += len; 37 s->ds_string[s->ds_idx] = 0; 38-- 39cgit v1.2.1 40 41