bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH 10/14] Do not depend on always defined macros


From: gscrivano
Subject: [Bug-wget] [PATCH 10/14] Do not depend on always defined macros
Date: Wed, 11 Jun 2014 17:05:21 +0200

From: Giuseppe Scrivano <address@hidden>

---
 ChangeLog       |  3 +++
 configure.ac    |  7 ++----
 src/ChangeLog   | 11 +++++++++
 src/connect.c   |  5 +---
 src/convert.c   |  4 +--
 src/css-url.c   |  6 +----
 src/hash.c      |  6 +----
 src/mswindows.h | 19 --------------
 src/netrc.c     |  2 --
 src/progress.c  |  4 +--
 src/sysdep.h    | 77 +++++----------------------------------------------------
 src/utils.c     |  4 +--
 src/wget.h      |  6 -----
 vms/vms.h       |  2 --
 14 files changed, 29 insertions(+), 127 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e3f29f..7c17082 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-06-11  Giuseppe Scrivano  <address@hidden>
 
+       * configure.ac: Do not depend on always defined macros.
+       * vms/vms.h: Likewise.
+
        * Makefile.am: Remove @VAR@ with $FOO.
        * util/Makefile.am: Likewise.
 
diff --git a/configure.ac b/configure.ac
index fe35c2e..029b2fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,8 +146,7 @@ AC_C_VOLATILE
 
 dnl Check for basic headers, even though we expect them to exist and
 dnl #include them unconditionally in the code.  Their detection is
-dnl still needed because test programs used by Autoconf macros check
-dnl for STDC_HEADERS, HAVE_SYS_TYPES_H, etc. before using them.
+dnl still needed because test programs used by Autoconf macros check.
 dnl Without the checks they will fail to be included in test programs,
 dnl which will subsequently fail.
 AC_HEADER_STDC
@@ -188,9 +187,7 @@ AC_CHECK_TYPES([uint32_t, uintptr_t, intptr_t, int64_t])
 AC_CHECK_TYPES(sig_atomic_t, [], [], [
 #include <stdio.h>
 #include <sys/types.h>
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
+#include <inttypes.h>
 #include <signal.h>
 ])
 
diff --git a/src/ChangeLog b/src/ChangeLog
index 4a163ce..2d950b1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
 2014-06-11  Giuseppe Scrivano  <address@hidden>
 
+       * connect.c: Do not depend on always defined macros.
+       * convert.c: Likewise.
+       * css-url.c: Likewise.
+       * hash.c: Likewise.
+       * mswindows.h: Likewise.
+       * netrc.c: Likewise.
+       * progress.c: Likewise.
+       * sysdep.h: Likewise.
+       * utils.c: Likewise.
+       * wget.h: Likewise.
+
        * Makefile.am: Remove @VAR@ with $FOO.
 
        * DESCRIP_MODS.MMS: Remove terminating empty lines.
diff --git a/src/connect.c b/src/connect.c
index 1e4a44b..1fb1819 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -59,10 +59,7 @@ as that of the covered work.  */
 #include "connect.h"
 #include "hash.h"
 
-/* Apparently needed for Interix: */
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
+#include <stdint.h>
 
 /* Define sockaddr_storage where unavailable (presumably on IPv4-only
    hosts).  */
diff --git a/src/convert.c b/src/convert.c
index 6731ac0..31a831b 100644
--- a/src/convert.c
+++ b/src/convert.c
@@ -465,7 +465,7 @@ write_backup_file (const char *file, downloaded_file_t 
downloaded_file_return)
     converted_files = make_string_hash_table (0);
 
   /* We can get called twice on the same URL thanks to the
-     convert_all_links() call in main().  If we write the .orig file
+     convert_all_links() call in main.  If we write the .orig file
      each time in such a case, it'll end up containing the first-pass
      conversion, not the original file.  So, see if we've already been
      called on this file. */
@@ -835,7 +835,7 @@ register_download (const char *url, const char *file)
   hash_table_put (dl_url_file_map, xstrdup (url), xstrdup (file));
 }
 
-/* Register that FROM has been redirected to TO.  This assumes that TO
+/* Register that FROM has been redirected to "TO".  This assumes that TO
    is successfully downloaded and already registered using
    register_download() above.  */
 
diff --git a/src/css-url.c b/src/css-url.c
index da78673..c605798 100644
--- a/src/css-url.c
+++ b/src/css-url.c
@@ -41,11 +41,7 @@ as that of the covered work.  */
 #include <wget.h>
 
 #include <stdio.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <errno.h>
diff --git a/src/hash.c b/src/hash.c
index af8e583..393c775 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -55,11 +55,7 @@ as that of the covered work.  */
 # endif
 # include <ctype.h>
 # define c_tolower(x) tolower ((unsigned char) (x))
-# ifdef HAVE_STDINT_H
-#  include <stdint.h>
-# else
-   typedef unsigned long uintptr_t;
-# endif
+# include <stdint.h>
 #endif
 
 #include "hash.h"
diff --git a/src/mswindows.h b/src/mswindows.h
index e614d84..3b815f0 100644
--- a/src/mswindows.h
+++ b/src/mswindows.h
@@ -57,13 +57,6 @@ as that of the covered work.  */
 /* Declares getpid(). */
 #include <process.h>
 
-#ifndef S_ISDIR
-# define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
-#endif
-#ifndef S_ISLNK
-# define S_ISLNK(a) 0
-#endif
-
 /* We have strcasecmp and strncasecmp, just under different names.  */
 #ifndef HAVE_STRCASECMP
 # define strcasecmp stricmp
@@ -90,18 +83,6 @@ typedef __int64 wgint;
 # define strtoll_type __int64
 #endif
 
-/* Windows has no symlink, therefore no lstat.  Without symlinks lstat
-   is equivalent to stat anyway.  */
-#define lstat stat
-
-/* Define LFS aliases for stat and fstat. */
-#ifdef stat_alias
-# define stat(f, b) stat_alias (f, b)
-#endif
-#ifdef fstat_alias
-# define fstat(f, b) fstat_alias (f, b)
-#endif
-
 #define PATH_SEPARATOR '\\'
 
 /* Additional declarations needed for IPv6: */
diff --git a/src/netrc.c b/src/netrc.c
index bad574d..dec9e2a 100644
--- a/src/netrc.c
+++ b/src/netrc.c
@@ -161,8 +161,6 @@ search_netrc (const char *host, const char **acc, const 
char **passwd,
 
 #ifdef STANDALONE
 
-#include <assert.h>
-
 /* Normally, these functions would be defined by your package.  */
 # define xmalloc malloc
 # define xfree free
diff --git a/src/progress.c b/src/progress.c
index 0c809eb..df36e2c 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -36,9 +36,7 @@ as that of the covered work.  */
 #include <assert.h>
 #include <unistd.h>
 #include <signal.h>
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
+#include <wchar.h>
 
 #include "progress.h"
 #include "utils.h"
diff --git a/src/sysdep.h b/src/sysdep.h
index 069882a..3159c99 100644
--- a/src/sysdep.h
+++ b/src/sysdep.h
@@ -78,35 +78,15 @@ as that of the covered work.  */
    These have to be after the above namespace tweaks, but before any
    non-preprocessor code.  */
 
-#if HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined WINDOWS
-# include <malloc.h>
-# ifndef alloca
-#  define alloca _alloca
-# endif
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef  __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
+#include <alloca.h>
 
 /* Must include these, so we can test for the missing stat macros and
    define them as necessary.  */
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef HAVE_INTTYPES_H
-  /* Compaq C V6.5-303 (dtk) on HP Tru64 UNIX V5.1B (Rev. 2650) needs: */
-# include <stdint.h>
-# include <inttypes.h>
-#endif
+#include <stdint.h>
+#include <inttypes.h>
 
 #ifdef WINDOWS
 /* Windows doesn't have some functions normally found on Unix-like
@@ -121,34 +101,6 @@ void *alloca (size_t);
 /* Provided by gnulib on systems that don't have it: */
 # include <stdbool.h>
 
-/* Needed for compilation under OS/2 and MSDOS */
-#if defined(__EMX__) || defined(MSDOS)
-# ifndef S_ISLNK
-#  define S_ISLNK(m) 0
-# endif
-# ifndef lstat
-#  define lstat stat
-# endif
-#endif /* __EMX__ || MSDOS */
-
-/* Reportedly, stat() macros are broken on some old systems.  Those
-   systems will have to fend for themselves, as I will not introduce
-   new code to handle it.
-
-   However, I will add code for *missing* macros, and the following
-   are reportedly missing from many systems.  */
-#ifndef S_ISLNK
-# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#ifndef S_ISDIR
-# define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
-#endif
-#ifndef S_ISREG
-# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
-#endif
-
-/* These are needed so we can #define struct_stat to struct _stati64
-   under Windows. */
 #ifndef struct_stat
 # define struct_stat struct stat
 #endif
@@ -156,6 +108,8 @@ void *alloca (size_t);
 # define struct_fstat struct stat
 #endif
 
+#include <intprops.h>
+
 /* For CHAR_BIT, LONG_MAX, etc. */
 #include <limits.h>
 
@@ -163,9 +117,6 @@ void *alloca (size_t);
 # define CHAR_BIT 8
 #endif
 
-/* From gnulib, simplified to assume a signed type. */
-#define TYPE_MAXIMUM(t) ((t) (~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
-
 /* These are defined in cmpt.c if missing, so we must declare
    them.  */
 #ifndef HAVE_STRCASECMP
@@ -212,23 +163,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, 
va_list arg);
 # define SYSTEM_FNMATCH
 #endif
 
-#ifdef SYSTEM_FNMATCH
-# include <fnmatch.h>
-#else  /* not SYSTEM_FNMATCH */
-/* Define fnmatch flags.  Undef them first to avoid warnings in case
-   an evil library include chose to include system fnmatch.h.  */
-# undef FNM_PATHNAME
-# undef FNM_NOESCAPE
-# undef FNM_PERIOD
-# undef FNM_NOMATCH
-
-# define FNM_PATHNAME   (1 << 0) /* No wildcard can ever match `/'.  */
-# define FNM_NOESCAPE   (1 << 1) /* Backslashes don't quote special chars.  */
-# define FNM_PERIOD     (1 << 2) /* Leading `.' is matched only explicitly.  */
-# define FNM_NOMATCH    1
-
-int fnmatch (const char *, const char *, int);
-#endif
+#include <fnmatch.h>
 
 /* Provide sig_atomic_t if the system doesn't.  */
 #ifndef HAVE_SIG_ATOMIC_T
diff --git a/src/utils.c b/src/utils.c
index e0a6647..ebce0b8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -65,9 +65,7 @@ as that of the covered work.  */
 
 /* For TIOCGWINSZ and friends: */
 #include <sys/ioctl.h>
-#ifdef HAVE_TERMIOS_H
-# include <termios.h>
-#endif
+#include <termios.h>
 
 /* Needed for Unix version of run_with_timeout. */
 #include <signal.h>
diff --git a/src/wget.h b/src/wget.h
index 6bdbe7a..331e8e2 100644
--- a/src/wget.h
+++ b/src/wget.h
@@ -72,12 +72,6 @@ as that of the covered work.  */
    variables.  -- explanation partly taken from GNU make.  */
 #define N_(string) string
 
-#if ! ENABLE_NLS
-# undef HAVE_WCHAR_H
-# undef HAVE_WCWIDTH
-# undef HAVE_MBTOWC
-#endif /* not ENABLE_NLS */
-
 #if HAVE_WCWIDTH && HAVE_MBTOWC
 # define USE_NLS_PROGRESS_BAR 1
 #else
diff --git a/vms/vms.h b/vms/vms.h
index d65aeda..19efdef 100644
--- a/vms/vms.h
+++ b/vms/vms.h
@@ -54,8 +54,6 @@ int utime( const char *path, const struct utimbuf *times);
 */
 #if defined(__VAX) || __CRTL_VER < 70301000
 
-#define lstat( __p1, __p2) stat( __p1, __p2)
-
 #endif /* defined(__VAX) || __CRTL_VER < 70301000 */
 
 
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]