Mercurial > hg > octave-kai > gnulib-hg
diff lib/utimecmp.c @ 5691:ec62790f0938
Factor int-properties macros into a single file, except for
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Wed, 09 Mar 2005 19:11:23 +0000 (2005-03-09) |
parents | a7cf26af736e |
children | a48fb0e98c8c |
line wrap: on
line diff
--- a/lib/utimecmp.c +++ b/lib/utimecmp.c @@ -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" @@ -50,14 +51,6 @@ # 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 @@ 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;