Do not depend on always defined macros

This commit is contained in:
Giuseppe Scrivano 2014-06-11 16:31:44 +02:00
parent d1ab00cab4
commit ffccc7d3be
14 changed files with 29 additions and 135 deletions

View File

@ -1,5 +1,8 @@
2014-06-11 Giuseppe Scrivano <gscrivan@redhat.com>
* configure.ac: Do not depend on always defined macros.
* vms/vms.h: Likewise.
* Makefile.am: Remove @VAR@ with $FOO.
* util/Makefile.am: Likewise.

View File

@ -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>
])

View File

@ -1,5 +1,16 @@
2014-06-11 Giuseppe Scrivano <gscrivan@redhat.com>
* 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.

View File

@ -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). */

View File

@ -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. */

View File

@ -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>

View File

@ -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"

View File

@ -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: */

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -49,16 +49,6 @@ int utime( const char *path, const struct utimbuf *times);
#endif /* __CRTL_VER < 70300000 */
/* Emergency substitution of stat() for lstat() for VAX and VMS CRTL
before V7.3-1.
*/
#if defined(__VAX) || __CRTL_VER < 70301000
#define lstat( __p1, __p2) stat( __p1, __p2)
#endif /* defined(__VAX) || __CRTL_VER < 70301000 */
/* Global storage. */
/* VMS destination file system type. < 0: unset/unknown