From e6b76459dba3061563c4fc3cb25294dec4ea1b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 14 Feb 2020 16:13:47 +0100 Subject: [PATCH] Remove alloca includes and macros * bootstrap.conf: Remove gnulib module 'alloca'. * src/sysdep.h: Remove include of alloca.h. * src/wget.h: Likewise, remove macros BOUNDED_TO_ALLOCA and STRDUP_ALLOCA. --- bootstrap.conf | 1 - src/sysdep.h | 1 - src/wget.h | 26 -------------------------- 3 files changed, 28 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 40bbf2ce..7ebe221b 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -27,7 +27,6 @@ checkout_only_file= # gnulib modules used by this package. gnulib_modules=" accept -alloca announce-gen base32 bind diff --git a/src/sysdep.h b/src/sysdep.h index 3303fda5..f623e8db 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -36,7 +36,6 @@ as that of the covered work. */ /* Provided by gnulib on systems that don't have it: */ -#include #include #include #include diff --git a/src/wget.h b/src/wget.h index 3a412669..fcc0d361 100644 --- a/src/wget.h +++ b/src/wget.h @@ -209,7 +209,6 @@ typedef double SUM_SIZE_INT; #include "options.h" /* Everything uses this, so include them here directly. */ -#include #ifdef __cplusplus # undef _Noreturn #endif @@ -253,18 +252,6 @@ static inline unsigned char _unhex(unsigned char c) #define XNUM_TO_DIGIT(x) ("0123456789ABCDEF"[x] + 0) #define XNUM_TO_digit(x) ("0123456789abcdef"[x] + 0) -/* Copy the data delimited with BEG and END to alloca-allocated - storage, and zero-terminate it. Arguments are evaluated only once, - in the order BEG, END, PLACE. */ -#define BOUNDED_TO_ALLOCA(beg, end, place) do { \ - const char *BTA_beg = (beg); \ - int BTA_len = (end) - BTA_beg; \ - char **BTA_dest = &(place); \ - *BTA_dest = alloca (BTA_len + 1); \ - memcpy (*BTA_dest, BTA_beg, BTA_len); \ - (*BTA_dest)[BTA_len] = '\0'; \ -} while (0) - /* Return non-zero if string bounded between BEG and END is equal to STRING_LITERAL. The comparison is case-sensitive. */ #define BOUNDED_EQUAL(beg, end, string_literal) \ @@ -276,19 +263,6 @@ static inline unsigned char _unhex(unsigned char c) ((end) - (beg) == sizeof (string_literal) - 1 \ && !c_strncasecmp (beg, string_literal, sizeof (string_literal) - 1)) -/* Like ptr=strdup(str), but allocates the space for PTR on the stack. - This cannot be an expression because this is not portable: - #define STRDUP_ALLOCA(str) (strcpy (alloca (strlen (str) + 1), str)) - The problem is that some compilers can't handle alloca() being an - argument to a function. */ - -#define STRDUP_ALLOCA(ptr, str) do { \ - char **SA_dest = &(ptr); \ - const char *SA_src = (str); \ - *SA_dest = (char *)alloca (strlen (SA_src) + 1); \ - strcpy (*SA_dest, SA_src); \ -} while (0) - /* Generally useful if you want to avoid arbitrary size limits but don't need a full dynamic array. Assumes that BASEVAR points to a malloced array of TYPE objects (or possibly a NULL pointer, if