Factor int-properties macros into a single file, except for
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 9 Mar 2005 19:11:23 +0000 (19:11 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 9 Mar 2005 19:11:23 +0000 (19:11 +0000)
glibc-related files.
* lib/intprops.h: New file.
* lib/getloadavg.c: Include it instead of limits.h.
(INT_STRLEN_BOUND): Remove.
* lib/human.c: Include intprops.h.
(group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
* lib/human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000.
* lib/inttostr.h: Include intprops.h instead of limits.h.
(INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove.
* lib/mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros,
for consistency with intprops.h.
(time_t_is_integer, twos_complement_arithmetic): Use them.
* lib/sig2str.h: Include <signal.h>, intprops.h.
(INT_STRLEN_BOUND): Remove.
* lib/strftime.c (TYPE_SIGNED): Remove.
(INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
* lib/strtol.c: Adjust comments to match intprops.h.
* lib/userspec.c: Include intprops.h.
(TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
* lib/utimecmp.c, lib/xnanosleep.c, lib/xstrtol.c: Likewise.
* lib/utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT
instead of rolling our own expressions.
* lib/xstrtol.c: Include xstrtol.h first, to test interface.
* modules/getloadavg (Files): Add lib/intprops.h.
* modules/human (Files): Likewise.
* modules/inttostr (Files): Likewise.
* modules/sig2str (Files): Likewise.
* modules/userspec (Files): Likewise.
* modules/utimecmp (Files): Likewise.
* modules/xnanosleep (Files): Likewise.
* modules/xstrtol (Files): Likewise.

22 files changed:
lib/ChangeLog
lib/getloadavg.c
lib/human.c
lib/human.h
lib/intprops.h [new file with mode: 0644]
lib/inttostr.h
lib/mktime.c
lib/sig2str.h
lib/strftime.c
lib/strtol.c
lib/userspec.c
lib/utimecmp.c
lib/xnanosleep.c
lib/xstrtol.c
modules/getloadavg
modules/human
modules/inttostr
modules/sig2str
modules/userspec
modules/utimecmp
modules/xnanosleep
modules/xstrtol

index 0a9a5e2b5b2fe6dc77b41f8d89a82784420d7095..ee53ff7280390f6cc8b993e29a61f1f5f177f04c 100644 (file)
@@ -1,3 +1,40 @@
+2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Factor int-properties macros into a single file, except for
+       glibc-related files.
+       * intprops.h: New file.
+       * getloadavg.c: Include it instead of limits.h.
+       (INT_STRLEN_BOUND): Remove.
+       * human.c: Include intprops.h.
+       (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
+       * human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000.
+       * inttostr.h: Include intprops.h instead of limits.h.
+       (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove.
+       * mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros,
+       for consistency with intprops.h.
+       (time_t_is_integer, twos_complement_arithmetic): Use them.
+       * sig2str.h: Include <signal.h>, intprops.h.
+       (INT_STRLEN_BOUND): Remove.
+       * strftime.c (TYPE_SIGNED): Remove.
+       (INT_STRLEN_BOUND): Switch to same implementation as intprops.h.
+       * strtol.c: Adjust comments to match intprops.h.
+       * userspec.c: Include intprops.h.
+       (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
+       * utimecmp.c, xnanosleep.c, xstrtol.c: Likewise.
+       * utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT
+       instead of rolling our own expressions.
+       * xstrtol.c: Include xstrtol.h first, to test interface.
+
+       * strftime.c: Include <stdbool.h>.  Use bool where appropriate,
+       instead of int.
+       (my_strftime): Do not mishandle years close to INT_MAX, by doing
+       the right thing even if adding 1900 would overflow.  Similarly
+       for tm_mon + 1 and tm_yday + 1.
+       Make %Y always equivalent to %C%y, and similarly for %G and %g.
+       (DO_NUMBER, DO_NUMBER_SPACEPAD): Set digits to d, not a conditional.
+       (DO_SIGNED_NUMBER): New macro.
+       (my_strftime) [HAVE_TZNAME]: Don't dump core if tp->tm_dst > 1.
+
 2005-03-07  Bruno Haible  <bruno@clisp.org>
 
        * pagealign_alloc.c (MAP_FILE, MAP_FAILED): Define fallbacks.
index 8b6067b8c6293ac03b8f31c1cd355a4551d4e626..7732ddd0dbf6d234ddc1b2800a166921b0d312cc 100644 (file)
@@ -1,7 +1,7 @@
 /* Get the system load averages.
 
    Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994,
-   1995, 1997, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+   1995, 1997, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
    Bugs can be reported to bug-gnulib@gnu.org.
 
 # include "c-strtod.h"
 # include "cloexec.h"
+# include "intprops.h"
 # include "xalloc.h"
 
 /* The existing Emacs configuration files define a macro called
 #  include <unistd.h>
 # endif
 
-# include <limits.h>
-
 /* LOAD_AVE_TYPE should only get defined if we're going to use the
    nlist method.  */
 # if !defined (LOAD_AVE_TYPE) && (defined (BSD) || defined (LDAV_CVT) || defined (KERNEL_FILE) || defined (LDAV_SYMBOL))
@@ -578,11 +577,6 @@ getloadavg (double loadavg[], int nelem)
 #   define LINUX_LDAV_FILE "/proc/loadavg"
 #  endif
 
-/* Upper bound on the string length of an integer converted to string.
-   302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
-   add 1 for integer division truncation; add 1 more for a minus sign.  */
-#  define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
-
   char ldavgbuf[3 * (INT_STRLEN_BOUND (long int) + sizeof ".00")];
   char const *ptr = ldavgbuf;
   int fd, count;
index 6acc03243cf65adb4d92d4e5f4801953d2db0db5..79336624a96055a15e7c604f3ed2660498e8e764 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <argmatch.h>
 #include <error.h>
+#include <intprops.h>
 #include <xstrtol.h>
 
 #ifndef SIZE_MAX
@@ -99,10 +100,8 @@ group_number (char *number, size_t numberlen,
   size_t i = numberlen;
 
   /* The maximum possible value for NUMBERLEN is the number of digits
-     in the square of the largest uintmax_t, so double the size of
-     uintmax_t before converting to a bound.  302 / 1000 is ceil
-     (log10 (2.0)).  Add 1 for integer division truncation.  */
-  char buf[2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1];
+     in the square of the largest uintmax_t, so double the size needed.  */
+  char buf[2 * INT_STRLEN_BOUND (uintmax_t) + 1];
 
   memcpy (buf, number, numberlen);
   d = number + numberlen;
index 553d7ad1bccbaa601951bb63906485788eb5584f..728263406725fb3eada5ce86137379b98e258237 100644 (file)
@@ -1,6 +1,6 @@
 /* human.h -- print human readable file size
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
 /* A conservative bound on the maximum length of a human-readable string.
    The output can be the square of the largest uintmax_t, so double
    its size before converting to a bound.
-   302 / 1000 is ceil (log10 (2.0)).  Add 1 for integer division truncation.
+   log10 (2.0) < 146/485.  Add 1 for integer division truncation.
    Also, the output can have a thousands separator between every digit,
    so multiply by MB_LEN_MAX + 1 and then subtract MB_LEN_MAX.
    Append 1 for a space before the suffix.
    Finally, append 3, the maximum length of a suffix.  */
 # define LONGEST_HUMAN_READABLE \
-  ((2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1) * (MB_LEN_MAX + 1) \
+  ((2 * sizeof (uintmax_t) * CHAR_BIT * 146 / 485 + 1) * (MB_LEN_MAX + 1) \
    - MB_LEN_MAX + 1 + 3)
 
 /* Options for human_readable.  */
diff --git a/lib/intprops.h b/lib/intprops.h
new file mode 100644 (file)
index 0000000..cd1c172
--- /dev/null
@@ -0,0 +1,55 @@
+/* intprops.h -- properties of integer types
+
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Written by Paul Eggert.  */
+
+#include <limits.h>
+
+/* The extra casts in the following macros work around compiler bugs,
+   e.g., in Cray C 5.0.3.0.  */
+
+/* True if the arithmetic type T is an integer type.  bool counts as
+   an integer.  */
+#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+
+/* True if negative values of the integer type T use twos complement
+   representation.  */
+#define TYPE_TWOS_COMPLEMENT(t) ((t) - (t) 1 == (t) ((t) ~ (t) 1 + (t) 1))
+
+/* True if the arithmetic type T is signed.  */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* The maximum and minimum values for the integer type T.  These
+   macros have undefined behavior if T is signed and has padding bits
+   (i.e., bits that do not contribute to the value), or if T uses
+   signed-magnitude representation.  If this is a problem for you,
+   please let us know how to fix it for your host.  */
+#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
+                             ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
+#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+
+/* Bound on length of the string representing an integer value or type T.
+   Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
+   add 1 for integer division truncation; add 1 more for a minus sign
+   if needed.  */
+#define INT_STRLEN_BOUND(t) \
+  ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
+
+/* Bound on buffer size needed to represent an integer value or type T,
+   including the terminating null.  */
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
index 6f2416b53faf6d45ba84a8f93437e1a1c78ad423..5f53681b50a1560086043d5f0dad4dd284937214 100644 (file)
@@ -1,6 +1,6 @@
 /* inttostr.h -- convert integers to printable strings
 
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 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
 # include <stdint.h>
 #endif
 
-#include <limits.h>
-
 #if HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
 
-/* Upper bound on the string length of an integer converted to string.
-   302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
-   add 1 for integer division truncation; add 1 more for a minus sign.  */
-#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
-
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+#include "intprops.h"
 
 char *offtostr (off_t, char *);
 char *imaxtostr (intmax_t, char *);
index a928c8c34531c49a28d7a0051132a2435dfc3691..9a92cb0085e6c62a962865f7421d70ca26fe7368 100644 (file)
@@ -1,5 +1,6 @@
 /* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1993-1999, 2002, 2003, 2004, 2005 Free Software Foundation,
+   Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert (eggert@twinsun.com).
 
    ? (a) >> (b)                \
    : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
-/* The extra casts work around common compiler bugs.  */
+/* The extra casts in the following macros work around compiler bugs,
+   e.g., in Cray C 5.0.3.0.  */
+
+/* True if the arithmetic type T is an integer type.  bool counts as
+   an integer.  */
+#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+
+/* True if negative values of the integer type T use twos complement
+   representation.  */
+#define TYPE_TWOS_COMPLEMENT(t) ((t) - (t) 1 == (t) ((t) ~ (t) 1 + (t) 1))
+
+/* True if the arithmetic type T is signed.  */
 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
-   It is necessary at least when t == time_t.  */
+
+/* The maximum and minimum values for the integer type T.  These
+   macros have undefined behavior if T is signed and has padding bits
+   (i.e., bits that do not contribute to the value), or if T uses
+   signed-magnitude representation.  If this is a problem for you,
+   please let us know how to fix it for your host.  */
 #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
                              ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
 #define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
@@ -79,8 +95,8 @@
 /* Verify a requirement at compile-time (unlike assert, which is runtime).  */
 #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
 
-verify (time_t_is_integer, (time_t) 0.5 == 0);
-verify (twos_complement_arithmetic, -1 == ~1 + 1);
+verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
+verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
 /* The code also assumes that signed integer overflow silently wraps
    around, but this assumption can't be stated without causing a
    diagnostic on some hosts.  */
@@ -208,8 +224,7 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
     {
       time_t bad = *t;
       time_t ok = 0;
-      /* Initialize to make the compiler happy.  */
-      struct tm tm = { 0, };
+      struct tm tm;
 
       /* BAD is a known unconvertible time_t, and OK is a known good one.
         Use binary search to narrow the range between BAD and OK until
index 4fbd21ce254d482156d39564d3ab78d5e836469c..bdc40f170e5daf22501feda0c7c43366dbc52a66 100644 (file)
@@ -1,6 +1,6 @@
 /* sig2str.h -- convert between signal names and numbers
 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 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
 
 /* Written by Paul Eggert.  */
 
-/* Include <signal.h> before including this file.  */
+#include <signal.h>
 
 /* Don't override system declarations of SIG2STR_MAX, sig2str, str2sig.  */
 #ifndef SIG2STR_MAX
 
-/* Upper bound on the string length of an integer converted to string.
-   302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
-   add 1 for integer division truncation; add 1 more for a minus sign.  */
-# define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
+# include "intprops.h"
 
 /* Size of a buffer needed to hold a signal name like "HUP".  */
 # define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1)
index 6d742f265504200bfb3899bc8a9289dff59d2ca8..8085a59925515f3286a1ff97540157791036c9f0 100644 (file)
@@ -120,15 +120,12 @@ extern char *tzname[];
    ? (a) >> (b)                \
    : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
-#define TYPE_SIGNED(t) ((t) -1 < 0)
-
-/* Bound on length of the string representing an integer value of type t.
-   Subtract one for the sign bit if t is signed;
-   302 / 1000 is log10 (2) rounded up;
-   add one for integer division truncation;
-   add one more for a minus sign if t is signed.  */
+/* Bound on length of the string representing an integer value or type T.
+   Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485;
+   add 1 for integer division truncation; add 1 more for a minus sign
+   if needed.  */
 #define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
 ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2)
 
 #define TM_YEAR_BASE 1900
 
index e2b1589a7d1e6528e3c449f5051e204d6dfc24a0..a95a765088a9d14545e23466ddb41a6e672a1ffa 100644 (file)
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003
+   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
    Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
@@ -124,11 +124,19 @@ extern int errno;
 # define STRTOL_LONG_MAX LONG_LONG_MAX
 # define STRTOL_ULONG_MAX ULONG_LONG_MAX
 
-/* The extra casts work around common compiler bugs,
-   e.g. Cray C 5.0.3.0 when t == time_t.  */
+/* The extra casts in the following macros work around compiler bugs,
+   e.g., in Cray C 5.0.3.0.  */
+
+/* True if the arithmetic type T is signed.  */
 # ifndef TYPE_SIGNED
 #  define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 # endif
+
+/* The maximum and minimum values for the integer type T.  These
+   macros have undefined behavior if T is signed and has padding bits
+   (i.e., bits that do not contribute to the value), or if T uses
+   signed-magnitude representation.  If this is a problem for you,
+   please let us know how to fix it for your host.  */
 # ifndef TYPE_MINIMUM
 #  define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
                                ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
index 037961d4746374e5d3b02c2a03c0f64ddc2b4ac9..33a9cfd1a2c43103c1627e419e0bb19dd2280e9a 100644 (file)
@@ -1,5 +1,5 @@
 /* userspec.c -- Parse a user and group string.
-   Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2004 Free Software
+   Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2005 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@
 # include <unistd.h>
 #endif
 
+#include "intprops.h"
 #include "inttostr.h"
 #include "strdup.h"
 #include "xalloc.h"
@@ -66,14 +67,6 @@ struct group *getgrgid ();
 # define endpwent() ((void) 0)
 #endif
 
-/* The extra casts work around common compiler bugs.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
-   It is necessary at least when t == time_t.  */
-#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
-                             ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
-#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-
 #ifndef UID_T_MAX
 # define UID_T_MAX TYPE_MAXIMUM (uid_t)
 #endif
index 1ff61f39aefb260b1d41eb198a8dddaceb073525..edce9ef121976b8ab57ce51d821bea0e6e1342af 100644 (file)
@@ -1,6 +1,6 @@
 /* utimecmp.c -- compare file time stamps
 
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include "hash.h"
+#include "intprops.h"
 #include "timespec.h"
 #include "utimens.h"
 #include "xalloc.h"
 # define SIZE_MAX ((size_t) -1)
 #endif
 
-/* The extra casts work around common compiler bugs.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
-   It is necessary at least when t == time_t.  */
-#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
-                             ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
-#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-
 enum { BILLION = 1000 * 1000 * 1000 };
 
 /* Best possible resolution that utimens can set and stat can return,
@@ -140,8 +133,8 @@ utimecmp (char const *dst_name,
 
      time_t might be unsigned.  */
 
-  verify (time_t_is_integer, (time_t) 0.5 == 0);
-  verify (twos_complement_arithmetic, -1 == ~1 + 1);
+  verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
+  verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
 
   /* Destination and source time stamps.  */
   time_t dst_s = dst_stat->st_mtime;
index fcfe3d551dfe2dc7d7e5ec0810f14a93008e613a..fe98165a5c765bb9d9f4574f1f06b773a73c86bf 100644 (file)
 #include <sys/types.h>
 #include <time.h>
 
-#include "timespec.h"
-
-/* The extra casts work around common compiler bugs.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
-   It is necessary at least when t == time_t.  */
-#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
-                             ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
-#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+#include "intprops.h"
 
 #ifndef TIME_T_MAX
 # define TIME_T_MAX TYPE_MAXIMUM (time_t)
index 906e4a1cc1e936ae56211365ce892050c8d1f62d..af81eae9e6df9236df5aaf59711705ea1440074a 100644 (file)
@@ -1,7 +1,7 @@
 /* A more useful interface to strtol.
 
-   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free
-   Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+   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
@@ -23,6 +23,8 @@
 # include <config.h>
 #endif
 
+#include "xstrtol.h"
+
 #ifndef __strtol
 # define __strtol strtol
 # define __strtol_t long int
 #include <stdlib.h>
 #include <string.h>
 
-/* The extra casts work around common compiler bugs.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
-                             ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
-                             : (t) 0))
-#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+#include "intprops.h"
 
 #ifndef STRTOL_T_MINIMUM
 # define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t)
@@ -62,8 +59,6 @@
 
 #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
 
-#include "xstrtol.h"
-
 #if !HAVE_DECL_STRTOIMAX && !defined strtoimax
 intmax_t strtoimax ();
 #endif
index e2ede2bdc2d624d368175f73724c4e5af4483138..8d02810a1b1d47c8b28d0bae5f6357c27a8c00a9 100644 (file)
@@ -3,6 +3,7 @@ Return the current system load averages.
 
 Files:
 lib/getloadavg.c
+lib/intprops.h
 
 Depends-on:
 cloexec
index 78ab32496381173c3d47cba2f6e56149b54decc2..5b7ff6a13f60f666239e0871247de13c83bc6575 100644 (file)
@@ -5,6 +5,7 @@ with K/M/G suffix.
 Files:
 lib/human.h
 lib/human.c
+lib/intprops.h
 m4/ulonglong.m4
 m4/stdint_h.m4
 m4/inttypes_h.m4
@@ -32,4 +33,3 @@ GPL
 
 Maintainer:
 Paul Eggert
-
index f070d3f3906eb25eb87aa90753474a043aca5b32..b17445194f2e36b44c0c67ff14b2d9db17faf919 100644 (file)
@@ -3,6 +3,7 @@ Convert integers to printable strings.
 
 Files:
 lib/imaxtostr.c
+lib/intprops.h
 lib/inttostr.c
 lib/inttostr.h
 lib/offtostr.c
index 42c8073030afab9dd7ff6a34b05e74f048ea139e..5f6fce5a38c2ffa34d41c706ce69994af961e0cc 100644 (file)
@@ -2,6 +2,7 @@ Description:
 Convert between signal names and signal numbers.
 
 Files:
+lib/intprops.h
 lib/sig2str.h
 lib/sig2str.c
 m4/sig2str.m4
@@ -22,4 +23,3 @@ GPL
 
 Maintainer:
 Paul Eggert, Jim Meyering
-
index a0b1ec29fd63050ae7333802443b9eb8a7fdb79b..98521fc3298bd00518b53715cc9b66ec2fd1a02d 100644 (file)
@@ -2,6 +2,7 @@ Description:
 Parse a `user:group' specifier (e.g. the first argument of chown utility).
 
 Files:
+lib/intprops.h
 lib/userspec.c
 lib/userspec.h
 m4/userspec.m4
index d65ef3e33696bc8ff362927b3a2aea00941c1249..64a4fa320734150ede14febcdc076bc6ff8b3b52 100644 (file)
@@ -2,6 +2,7 @@ Description:
 compare file time stamps
 
 Files:
+lib/intprops.h
 lib/utimecmp.h
 lib/utimecmp.c
 m4/utimecmp.m4
@@ -26,4 +27,3 @@ GPL
 
 Maintainer:
 Paul Eggert, Jim Meyering
-
index 18abf00981d15875ff0aea185071ae859fe032cf..546daf40915ba8c6e5de1f62a713a9ea7f9b2b38 100644 (file)
@@ -2,6 +2,7 @@ Description:
 a more convenient interface to nanosleep
 
 Files:
+lib/intprops.h
 lib/xnanosleep.h
 lib/xnanosleep.c
 m4/xnanosleep.m4
index f453cf2e00cc238b4953bf5e34b1395248dc050a..04c825b03becf4ed43b7e976dccbcb5337564079 100644 (file)
@@ -2,6 +2,7 @@ Description:
 Convert string to 'long` or 'unsigned long', with error checking.
 
 Files:
+lib/intprops.h
 lib/xstrtol.h
 lib/xstrtol.c
 lib/xstrtoul.c