0003-Fix-previous-commit.patch 1.1 KB

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