From: Jim Meyering Date: Sun, 20 Dec 2009 18:41:39 +0000 (+0100) Subject: maint: remove lots of obsolete #if...HAVE_* checks X-Git-Tag: v1.4~15 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9375a72a92bb905d0935f296057148df0562def4;p=debian%2Fgzip maint: remove lots of obsolete #if...HAVE_* checks Remove many always-true cpp tests like #ifdef HAVE_UNISTD_H, #ifdef HAVE_FCNTL_H and #ifdef SSIZE_MAX. * gzip.c: As above. * gzip.h: Likewise. * inflate.c: Likewise. * tailor.h: Likewise. * unlzw.c: Likewise. * util.c: Likewise. * zip.c: Likewise. --- diff --git a/gzip.c b/gzip.c index cdaaab3..4ecfdaf 100644 --- a/gzip.c +++ b/gzip.c @@ -74,23 +74,11 @@ static char const *const license_msg[] = { /* configuration */ -#ifdef HAVE_FCNTL_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else - extern int errno; -#endif +#include +#include +#include +#include +#include #ifndef NO_DIR # define NO_DIR 0 diff --git a/gzip.h b/gzip.h index 7addad9..92b4087 100644 --- a/gzip.h +++ b/gzip.h @@ -47,20 +47,8 @@ #include #include /* for off_t */ #include -#if defined HAVE_STRING_H || defined STDC_HEADERS -# include -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H && !defined __GNUC__ -# include -# endif -# define memzero(s, n) memset ((voidp)(s), 0, (n)) -#else -# include -# define strchr index -# define strrchr rindex -# define memcpy(d, s, n) bcopy((s), (d), (n)) -# define memcmp(s1, s2, n) bcmp((s1), (s2), (n)) -# define memzero(s, n) bzero((s), (n)) -#endif +#include +#define memzero(s, n) memset ((voidp)(s), 0, (n)) #ifndef RETSIGTYPE # define RETSIGTYPE void diff --git a/inflate.c b/inflate.c index b72c187..8167f20 100644 --- a/inflate.c +++ b/inflate.c @@ -117,9 +117,7 @@ #include #include "tailor.h" -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#endif +#include #include "gzip.h" #define slide window diff --git a/tailor.h b/tailor.h index 3cb16ee..cd3be11 100644 --- a/tailor.h +++ b/tailor.h @@ -200,11 +200,6 @@ #endif #if defined(ATARI) || defined(atarist) -# ifndef STDC_HEADERS -# define STDC_HEADERS -# define HAVE_UNISTD_H -# define HAVE_DIRENT_H -# endif # define ASMV # define OS_CODE 0x05 # ifdef TOSFS diff --git a/unlzw.c b/unlzw.c index 5cf95b5..fb9ff76 100644 --- a/unlzw.c +++ b/unlzw.c @@ -10,12 +10,8 @@ #include #include "tailor.h" -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif +#include +#include #include "gzip.h" #include "lzw.h" diff --git a/util.c b/util.c index d0d7774..83ddac2 100644 --- a/util.c +++ b/util.c @@ -24,21 +24,11 @@ #include "tailor.h" -#ifdef HAVE_LIMITS_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif - -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else - extern int errno; -#endif +#include +#include +#include +#include +#include #include "gzip.h" #include "crypt.h" @@ -146,10 +136,8 @@ read_buffer (fd, buf, cnt) voidp buf; unsigned int cnt; { -#ifdef SSIZE_MAX - if (SSIZE_MAX < cnt) - cnt = SSIZE_MAX; -#endif + if (INT_MAX < cnt) + cnt = INT_MAX; return read (fd, buf, cnt); } @@ -160,10 +148,8 @@ write_buffer (fd, buf, cnt) voidp buf; unsigned int cnt; { -#ifdef SSIZE_MAX - if (SSIZE_MAX < cnt) - cnt = SSIZE_MAX; -#endif + if (INT_MAX < cnt) + cnt = INT_MAX; return write (fd, buf, cnt); } @@ -297,59 +283,6 @@ void make_simple_name(name) } while (p != name); } - -#if !defined HAVE_STRING_H && !defined STDC_HEADERS - -/* Provide missing strspn and strcspn functions. */ - -# ifndef __STDC__ -# define const -# endif - -int strspn OF((const char *s, const char *accept)); -int strcspn OF((const char *s, const char *reject)); - -/* ======================================================================== - * Return the length of the maximum initial segment - * of s which contains only characters in accept. - */ -int strspn(s, accept) - const char *s; - const char *accept; -{ - register const char *p; - register const char *a; - register int count = 0; - - for (p = s; *p != '\0'; ++p) { - for (a = accept; *a != '\0'; ++a) { - if (*p == *a) break; - } - if (*a == '\0') return count; - ++count; - } - return count; -} - -/* ======================================================================== - * Return the length of the maximum inital segment of s - * which contains no characters from reject. - */ -int strcspn(s, reject) - const char *s; - const char *reject; -{ - register int count = 0; - - while (*s != '\0') { - if (strchr(reject, *s++) != NULL) return count; - ++count; - } - return count; -} - -#endif - /* ======================================================================== * Add an environment variable (if any) before argv, and update argc. * Return the expanded environment variable to be freed later, or NULL diff --git a/zip.c b/zip.c index 9dd167b..c0d96ae 100644 --- a/zip.c +++ b/zip.c @@ -24,12 +24,8 @@ #include "gzip.h" #include "crypt.h" -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif +#include +#include local ulg crc; /* crc on uncompressed file data */ off_t header_bytes; /* number of bytes in gzip header */