Sync from gnulib.

This commit is contained in:
Paul Eggert 2004-11-11 05:02:14 +00:00
parent f0dd13bca8
commit d2b4386d29
7 changed files with 55 additions and 26 deletions

View File

@ -1,3 +1,7 @@
2004-11-10 Paul Eggert <eggert@cs.ucla.edu>
* texinfo.tex: Sync from gnulib.
2004-11-02 Paul Eggert <eggert@cs.ucla.edu>
* texinfo.tex: Sync from gnulib.

View File

@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2004-10-31.06}
\def\texinfoversion{2004-11-08.15}
%
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
@ -1242,13 +1242,13 @@ where each line of input produces a line of output.}
% Read toc silently, to get counts of subentries for \pdfoutline.
\def\numchapentry##1##2##3##4{%
\def\thischapnum{##2}%
\let\thissecnum\empty
\let\thissubsecnum\empty
\def\thissecnum{0}%
\def\thissubsecnum{0}%
}%
\def\numsecentry##1##2##3##4{%
\advancenumber{chap\thischapnum}%
\def\thissecnum{##2}%
\let\thissubsecnum\empty
\def\thissubsecnum{0}%
}%
\def\numsubsecentry##1##2##3##4{%
\advancenumber{sec\thissecnum}%
@ -1257,9 +1257,9 @@ where each line of input produces a line of output.}
\def\numsubsubsecentry##1##2##3##4{%
\advancenumber{subsec\thissubsecnum}%
}%
\let\thischapnum\empty
\let\thissecnum\empty
\let\thissubsecnum\empty
\def\thischapnum{0}%
\def\thissecnum{0}%
\def\thissubsecnum{0}%
%
% use \def rather than \let here because we redefine \chapentry et
% al. a second time, below.

View File

@ -1,3 +1,7 @@
2004-11-10 Paul Eggert <eggert@cs.ucla.edu>
* allocsa.h, mbswidth.c, mktime.c, readlink.c: Sync from gnulib.
2004-11-06 Jim Meyering <jim@meyering.net>
* __fpending.c, __fpending.h: Remove files.

View File

@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003-2004 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
@ -77,6 +77,10 @@ extern void freesa (void *p);
#elif defined __cplusplus
template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
# define sa_alignof(type) offsetof (sa_alignof_helper<type>, __slot2)
#elif defined __hpux
/* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
values. */
# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
#else
# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
#endif
@ -90,14 +94,14 @@ enum
#ifdef HAVE_LONG_LONG
sa_alignment_longlong = sa_alignof (long long),
#endif
#ifdef HAVE_LONG_DOUBLE
#ifdef HAVE_LONG_DOUBLE
sa_alignment_longdouble = sa_alignof (long double),
#endif
sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1)
#ifdef HAVE_LONG_LONG
| (sa_alignment_longlong - 1)
#endif
#ifdef HAVE_LONG_DOUBLE
#ifdef HAVE_LONG_DOUBLE
| (sa_alignment_longdouble - 1)
#endif
) + 1,

View File

@ -91,7 +91,7 @@ int wcwidth ();
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is
the multibyte analogon of the wcswidth function. */
the multibyte analogue of the wcswidth function. */
int
mbswidth (const char *string, int flags)
{

View File

@ -45,6 +45,21 @@
# define mktime my_mktime
#endif /* DEBUG */
/* Shift A right by B bits portably, by dividing A by 2**B and
truncating towards minus infinity. A and B should be free of side
effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
INT_BITS is the number of useful bits in an int. GNU code can
assume that INT_BITS is at least 32.
ISO C99 says that A >> B is implementation-defined if A < 0. Some
implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
right in the usual way when A < 0, so SHR falls back on division if
ordinary A >> B doesn't seem to be the usual signed shift. */
#define SHR(a, b) \
(-1 >> 1 == -1 \
? (a) >> (b) \
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
/* 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.
@ -59,14 +74,13 @@
#ifndef TIME_T_MAX
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
#endif
#define TIME_T_MIDPOINT (((TIME_T_MIN + TIME_T_MAX) >> 1) + 1)
#define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
/* 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 (right_shift_propagates_sign, -1 >> 1 == -1);
/* 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. */
@ -132,12 +146,12 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid integer overflow here. */
int a4 = (year1 >> 2) + (TM_YEAR_BASE >> 2) - ! (year1 & 3);
int b4 = (year0 >> 2) + (TM_YEAR_BASE >> 2) - ! (year0 & 3);
int a4 = SHR (year1, 2) + SHR (TM_YEAR_BASE, 2) - ! (year1 & 3);
int b4 = SHR (year0, 2) + SHR (TM_YEAR_BASE, 2) - ! (year0 & 3);
int a100 = a4 / 25 - (a4 % 25 < 0);
int b100 = b4 / 25 - (b4 % 25 < 0);
int a400 = a100 >> 2;
int b400 = b100 >> 2;
int a400 = SHR (a100, 2);
int b400 = SHR (b100, 2);
int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
/* Compute the desired time in time_t precision. Overflow might
@ -321,14 +335,16 @@ __mktime_internal (struct tm *tp,
int LOG2_YEARS_PER_BIENNIUM = 1;
int approx_requested_biennia =
((year_requested >> LOG2_YEARS_PER_BIENNIUM)
- ((EPOCH_YEAR - TM_YEAR_BASE) >> LOG2_YEARS_PER_BIENNIUM)
+ (mday >> ALOG2_DAYS_PER_BIENNIUM)
+ (hour >> ALOG2_HOURS_PER_BIENNIUM)
+ (min >> ALOG2_MINUTES_PER_BIENNIUM)
+ (LEAP_SECONDS_POSSIBLE ? 0 : sec >> ALOG2_SECONDS_PER_BIENNIUM));
(SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
- SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
+ SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
+ SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
+ SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
+ (LEAP_SECONDS_POSSIBLE
? 0
: SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
int approx_biennia = t0 >> ALOG2_SECONDS_PER_BIENNIUM;
int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
int diff = approx_biennia - approx_requested_biennia;
int abs_diff = diff < 0 ? - diff : diff;
@ -346,7 +362,7 @@ __mktime_internal (struct tm *tp,
/* Overflow occurred. Try repairing it; this might work if
the time zone offset is enough to undo the overflow. */
time_t repaired_t0 = -1 - t0;
approx_biennia = repaired_t0 >> ALOG2_SECONDS_PER_BIENNIUM;
approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
diff = approx_biennia - approx_requested_biennia;
abs_diff = diff < 0 ? - diff : diff;
if (overflow_threshold < abs_diff)

View File

@ -1,5 +1,5 @@
/* Stub for readlink().
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003-2004 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
@ -22,6 +22,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stddef.h>
#if !HAVE_READLINK