From 74fcb0575a5b053a1b1078a5595c1795790c63cb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 8 Oct 2006 07:24:56 +0000 Subject: [PATCH] Don't include twice; this doesn't work in some cases, e.g., when config.h has "#define intmax_t long long int" and we include , , in that order. * fprintftime.c: Don't include config.h or fprintftime.h. * fts-cycle.c: Don't include config.h. * strftime.c: Include fprintftime.h if FPRINTFTIME is defined. * xstrtoimax.c: Remove copyright notice since it's short tnow. Don't include config.h or xstrtol.h. Define STRTOL_T_MINIMUM and STRTOL_T_MAXIMUM unconditionally, since we now assume gnulib inttypes.h. * xstrtoumax.c: Likewise. * xstrtol.c: Include config.h and xstrtol.h after defining __strtol and the like, so that this module is more like its siblings. (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [! defined STRTOL_T_MINIMUM]: Remove; no longer needed now that we assume gnulib inttypes.h. 2006-10-07 Bruno Haible --- lib/ChangeLog | 20 +++++++++++++++++++- lib/fprintftime.c | 3 --- lib/fts-cycle.c | 2 -- lib/strftime.c | 3 +++ lib/xstrtoimax.c | 30 ++---------------------------- lib/xstrtol.c | 21 ++++----------------- lib/xstrtoumax.c | 30 ++---------------------------- 7 files changed, 30 insertions(+), 79 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 4002832c38..08fc829ca2 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,4 +1,22 @@ -2006-10-03 Bruno Haible +2006-10-08 Paul Eggert + + Don't include twice; this doesn't work in some cases, + e.g., when config.h has "#define intmax_t long long int" and + we include , , in that order. + * fprintftime.c: Don't include config.h or fprintftime.h. + * fts-cycle.c: Don't include config.h. + * strftime.c: Include fprintftime.h if FPRINTFTIME is defined. + * xstrtoimax.c: Remove copyright notice since it's short tnow. + Don't include config.h or xstrtol.h. Define STRTOL_T_MINIMUM + and STRTOL_T_MAXIMUM unconditionally, since we now assume gnulib + inttypes.h. + * xstrtoumax.c: Likewise. + * xstrtol.c: Include config.h and xstrtol.h after defining + __strtol and the like, so that this module is more like its siblings. + (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [! defined STRTOL_T_MINIMUM]: + Remove; no longer needed now that we assume gnulib inttypes.h. + +2006-10-07 Bruno Haible * gl_sublist.h: New file. * gl_sublist.c: New file. diff --git a/lib/fprintftime.c b/lib/fprintftime.c index 2a455275b7..e6eb4f20f5 100644 --- a/lib/fprintftime.c +++ b/lib/fprintftime.c @@ -1,5 +1,2 @@ -#include - -#include "fprintftime.h" #define FPRINTFTIME 1 #include "strftime.c" diff --git a/lib/fts-cycle.c b/lib/fts-cycle.c index a5f38ab27d..8edf26ee4d 100644 --- a/lib/fts-cycle.c +++ b/lib/fts-cycle.c @@ -18,8 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "cycle-check.h" #include "hash.h" diff --git a/lib/strftime.c b/lib/strftime.c index 86cd1cf7e7..ffa51c0cc3 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -30,6 +30,9 @@ # include "../locale/localeinfo.h" #else # include +# if FPRINTFTIME +# include "fprintftime.h" +# endif #endif #include diff --git a/lib/xstrtoimax.c b/lib/xstrtoimax.c index 37b30d886d..b4baf5bc60 100644 --- a/lib/xstrtoimax.c +++ b/lib/xstrtoimax.c @@ -1,32 +1,6 @@ -/* xstrtoimax.c -- A more useful interface to strtoimax. - - Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Cloned by Jim Meyering. */ - -#include - -#include "xstrtol.h" - #define __strtol strtoimax #define __strtol_t intmax_t #define __xstrtol xstrtoimax -#ifdef INTMAX_MAX -# define STRTOL_T_MINIMUM INTMAX_MIN -# define STRTOL_T_MAXIMUM INTMAX_MAX -#endif +#define STRTOL_T_MINIMUM INTMAX_MIN +#define STRTOL_T_MAXIMUM INTMAX_MAX #include "xstrtol.c" diff --git a/lib/xstrtol.c b/lib/xstrtol.c index 2d1ba91543..c4557a0064 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -19,10 +19,6 @@ /* Written by Jim Meyering. */ -#include - -#include "xstrtol.h" - #ifndef __strtol # define __strtol strtol # define __strtol_t long int @@ -31,6 +27,10 @@ # define STRTOL_T_MAXIMUM LONG_MAX #endif +#include + +#include "xstrtol.h" + /* Some pre-ANSI implementations (e.g. SunOS 4) need stderr defined if assertion checking is enabled. */ #include @@ -44,19 +44,6 @@ #include "intprops.h" -#ifndef STRTOL_T_MINIMUM -# define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t) -# define STRTOL_T_MAXIMUM TYPE_MAXIMUM (__strtol_t) -#endif - -#if !HAVE_DECL_STRTOIMAX && !defined strtoimax -intmax_t strtoimax (); -#endif - -#if !HAVE_DECL_STRTOUMAX && !defined strtoumax -uintmax_t strtoumax (); -#endif - static strtol_error bkm_scale (__strtol_t *x, int scale_factor) { diff --git a/lib/xstrtoumax.c b/lib/xstrtoumax.c index 6fb35c7525..9a2349f00d 100644 --- a/lib/xstrtoumax.c +++ b/lib/xstrtoumax.c @@ -1,32 +1,6 @@ -/* xstrtoumax.c -- A more useful interface to strtoumax. - - Copyright (C) 1999, 2003, 2004, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Paul Eggert. */ - -#include - -#include "xstrtol.h" - #define __strtol strtoumax #define __strtol_t uintmax_t #define __xstrtol xstrtoumax -#ifdef UINTMAX_MAX -# define STRTOL_T_MINIMUM 0 -# define STRTOL_T_MAXIMUM UINTMAX_MAX -#endif +#define STRTOL_T_MINIMUM 0 +#define STRTOL_T_MAXIMUM UINTMAX_MAX #include "xstrtol.c" -- 2.30.2