mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Changes from <9t9pusol5a1.fsf@mraz.iskon.hr>.
This commit is contained in:
parent
4454f6ce0a
commit
c71f174ed6
@ -1,3 +1,11 @@
|
||||
2000-03-21 Hrvoje Niksic <hniksic@iskon.hr>
|
||||
|
||||
* wget.h (DO_REALLOC_FROM_ALLOCA): Ditto.
|
||||
|
||||
* sysdep.h (ISALNUM): New macro.
|
||||
(TOLOWER): Ditto.
|
||||
(TOUPPER): Ditto.
|
||||
|
||||
2000-03-10 Dan Harkless <dan-wget@dilvish.speed.net>
|
||||
|
||||
* html.c (idmatch): Implemented checking of my new --follow-tags
|
||||
|
@ -110,9 +110,12 @@ do { \
|
||||
versions are used consistently across the code. */
|
||||
#define ISASCII(x) isascii ((unsigned char)(x))
|
||||
#define ISALPHA(x) isalpha ((unsigned char)(x))
|
||||
#define ISALNUM(x) isalnum ((unsigned char)(x))
|
||||
#define ISSPACE(x) isspace ((unsigned char)(x))
|
||||
#define ISDIGIT(x) isdigit ((unsigned char)(x))
|
||||
#define ISXDIGIT(x) isxdigit ((unsigned char)(x))
|
||||
#define TOUPPER(x) toupper ((unsigned char)(x))
|
||||
#define TOLOWER(x) tolower ((unsigned char)(x))
|
||||
|
||||
/* Defined in cmpt.c: */
|
||||
#ifndef HAVE_STRERROR
|
||||
|
29
src/wget.h
29
src/wget.h
@ -160,6 +160,35 @@ char *xstrdup PARAMS ((const char *));
|
||||
XREALLOC_ARRAY (basevar, type, do_realloc_newsize); \
|
||||
} while (0)
|
||||
|
||||
/* Use this for small stack-allocated memory chunks that might grow.
|
||||
The initial array is created using alloca(), and this macro
|
||||
requests it to grow. If the needed size is larger than the array,
|
||||
this macro will use malloc to allocate it to new size, and copy the
|
||||
old contents. After that, successive invocations behave just like
|
||||
DO_REALLOC. */
|
||||
#define DO_REALLOC_FROM_ALLOCA(basevar, sizevar, needed_size, allocap, type) do \
|
||||
{ \
|
||||
/* 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); \
|
||||
if (do_realloc_newsize < 16) \
|
||||
do_realloc_newsize = 16; \
|
||||
(sizevar) = do_realloc_newsize; \
|
||||
} \
|
||||
if (do_realloc_newsize) \
|
||||
if (!allocap) \
|
||||
XREALLOC_ARRAY (basevar, type, do_realloc_newsize); \
|
||||
else \
|
||||
{ \
|
||||
void *drfa_new_basevar = xmalloc (do_realloc_newsize); \
|
||||
memcpy (drfa_new_basevar, basevar, sizevar); \
|
||||
(basevar) = drfa_new_basevar; \
|
||||
allocap = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Free FOO if it is non-NULL. */
|
||||
#define FREE_MAYBE(foo) do { if (foo) free (foo); } while (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user