From b4e6054de9f1a3e13602cc462b88ce892a30898e Mon Sep 17 00:00:00 2001 From: hniksic Date: Tue, 26 Jun 2001 02:48:51 -0700 Subject: [PATCH] [svn] Check for do_realloc_newsize in loop condition because we're no longer setting SIZEVAR here. --- src/ChangeLog | 7 +++---- src/wget.h | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 44d44f68..de743a8f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,7 @@ -2001-06-18 Hrvoje Niksic +2001-06-26 Hrvoje Niksic - * recur.c (convert_all_links): Make sure "../" stuff is properly - handled in cur_url->url before we hand it over to convert_links. - (register_download): Canonicalize URL before storing it. + * wget.h (DO_REALLOC_FROM_ALLOCA): Check for do_realloc_newsize in + loop condition because we're no longer setting SIZEVAR here. 2001-06-26 Hrvoje Niksic diff --git a/src/wget.h b/src/wget.h index fb7e3f49..3837d9b4 100644 --- a/src/wget.h +++ b/src/wget.h @@ -231,20 +231,20 @@ char *xstrdup_debug PARAMS ((const char *, const char *, int)); { \ /* Avoid side-effectualness. */ \ long do_realloc_needed_size = (needed_size); \ - long do_realloc_newsize = 0; \ - while ((sizevar) < (do_realloc_needed_size)) { \ - do_realloc_newsize = 2*(sizevar); \ + long do_realloc_newsize = (sizevar); \ + while (do_realloc_newsize < do_realloc_needed_size) { \ + do_realloc_newsize <<= 1; \ if (do_realloc_newsize < 16) \ do_realloc_newsize = 16; \ } \ - if (do_realloc_newsize) \ + if (do_realloc_newsize != (sizevar)) \ { \ if (!allocap) \ XREALLOC_ARRAY (basevar, type, do_realloc_newsize); \ else \ { \ void *drfa_new_basevar = xmalloc (do_realloc_newsize); \ - memcpy (drfa_new_basevar, basevar, sizevar); \ + memcpy (drfa_new_basevar, basevar, (sizevar)); \ (basevar) = drfa_new_basevar; \ allocap = 0; \ } \