shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS shishi/gl


From: shishi-commit
Subject: CVS shishi/gl
Date: Mon, 08 Nov 2004 15:50:18 +0100

Update of /home/cvs/shishi/gl
In directory dopio:/tmp/cvs-serv3157/gl

Modified Files:
        Makefile.am allocsa.h getdate.y getpass.c mktime.c readlink.c 
        setenv.h xreadlink.c 
Added Files:
        allocsa.valgrind 
Log Message:
Update.

--- /home/cvs/shishi/gl/Makefile.am     2004/10/05 18:55:59     1.47
+++ /home/cvs/shishi/gl/Makefile.am     2004/11/08 14:50:17     1.48
@@ -8,11 +8,10 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-#
 # Invoked as: gnulib-tool --import
 # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl 
--m4-base=gl/m4 --libtool  alloca alloca-opt allocsa error extensions getdate 
getdomainname gethostname getline getopt getpass getsubopt gettext gettime 
gettimeofday mktime progname readlink realloc restrict setenv stdbool strcase 
strchrnul strdup strndup strnlen timegm time_r timespec vasnprintf vasprintf 
xalloc xgetdomainname xgethostname xreadlink xsize xstrndup
 
-AUTOMAKE_OPTIONS = 1.8 gnits
+AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies
 
 noinst_LTLIBRARIES = libgnu.la
 
@@ -25,6 +24,9 @@
 CLEANFILES =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
+
+## begin gnulib module alloca
+
 BUILT_SOURCES += $(ALLOCA_H)
 EXTRA_DIST += alloca_.h
 
@@ -36,7 +38,11 @@
        mv address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
-libgnu_la_LIBADD += @ALLOCA@
+libgnu_la_LIBADD += @LTALLOCA@
+## end   gnulib module alloca
+
+## begin gnulib module alloca-opt
+
 BUILT_SOURCES += $(ALLOCA_H)
 EXTRA_DIST += alloca_.h
 
@@ -48,20 +54,38 @@
        mv address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
+## end   gnulib module alloca-opt
+
+## begin gnulib module allocsa
+
 libgnu_la_SOURCES += allocsa.h allocsa.c
+EXTRA_DIST += allocsa.valgrind
 
+## end   gnulib module allocsa
 
+## begin gnulib module getdate
 
 libgnu_la_SOURCES += getdate.h getdate.y
 BUILT_SOURCES += getdate.c
 MAINTAINERCLEANFILES += getdate.c
 
+## end   gnulib module getdate
+
+## begin gnulib module getdomainname
+
 libgnu_la_SOURCES += getdomainname.h
 
+## end   gnulib module getdomainname
+
+## begin gnulib module getline
 
 libgnu_la_SOURCES += getline.h
 EXTRA_DIST += getndelim2.h getndelim2.c
 
+## end   gnulib module getline
+
+## begin gnulib module getopt
+
 BUILT_SOURCES += $(GETOPT_H)
 EXTRA_DIST += getopt_.h getopt_int.h
 
@@ -73,23 +97,46 @@
        mv address@hidden $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t
 
+## end   gnulib module getopt
+
+## begin gnulib module getpass
+
 libgnu_la_SOURCES += getpass.h
 
+## end   gnulib module getpass
+
+## begin gnulib module getsubopt
+
 libgnu_la_SOURCES += getsubopt.h
 
+## end   gnulib module getsubopt
+
+## begin gnulib module gettext
+
 libgnu_la_SOURCES += gettext.h
 
+## end   gnulib module gettext
+
+## begin gnulib module gettime
+
 libgnu_la_SOURCES += gettime.c
 
+## end   gnulib module gettime
 
+## begin gnulib module progname
 
 libgnu_la_SOURCES += progname.h progname.c
 
+## end   gnulib module progname
 
-
+## begin gnulib module setenv
 
 libgnu_la_SOURCES += setenv.h
 
+## end   gnulib module setenv
+
+## begin gnulib module stdbool
+
 BUILT_SOURCES += $(STDBOOL_H)
 EXTRA_DIST += stdbool_.h
 
@@ -101,37 +148,98 @@
        mv address@hidden $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
+## end   gnulib module stdbool
+
+## begin gnulib module strcase
+
 libgnu_la_SOURCES += strcase.h
 
+## end   gnulib module strcase
+
+## begin gnulib module strchrnul
+
 libgnu_la_SOURCES += strchrnul.h
 
+## end   gnulib module strchrnul
+
+## begin gnulib module strdup
+
 libgnu_la_SOURCES += strdup.h
 
+## end   gnulib module strdup
+
+## begin gnulib module strndup
+
 libgnu_la_SOURCES += strndup.h
 
+## end   gnulib module strndup
+
+## begin gnulib module timegm
 
 libgnu_la_SOURCES += timegm.h
 
+## end   gnulib module timegm
+
+## begin gnulib module time_r
+
 libgnu_la_SOURCES += time_r.h
 
+## end   gnulib module time_r
+
+## begin gnulib module timespec
+
 libgnu_la_SOURCES += timespec.h
 
+## end   gnulib module timespec
+
+## begin gnulib module vasnprintf
+
 libgnu_la_SOURCES += printf-args.h printf-parse.h vasnprintf.h
 
+## end   gnulib module vasnprintf
+
+## begin gnulib module vasprintf
+
 libgnu_la_SOURCES += vasprintf.h
 
+## end   gnulib module vasprintf
+
+## begin gnulib module xalloc
+
 libgnu_la_SOURCES += xalloc.h xmalloc.c
 
+## end   gnulib module xalloc
+
+## begin gnulib module xgetdomainname
+
 libgnu_la_SOURCES += xgetdomainname.h xgetdomainname.c
 
+## end   gnulib module xgetdomainname
+
+## begin gnulib module xgethostname
+
 libgnu_la_SOURCES += xgethostname.h xgethostname.c
 
+## end   gnulib module xgethostname
+
+## begin gnulib module xreadlink
+
 libgnu_la_SOURCES += xreadlink.h xreadlink.c
 
+## end   gnulib module xreadlink
+
+## begin gnulib module xsize
+
 libgnu_la_SOURCES += xsize.h
 
+## end   gnulib module xsize
+
+## begin gnulib module xstrndup
+
 libgnu_la_SOURCES += xstrndup.h xstrndup.c
 
+## end   gnulib module xstrndup
+
 
 # Makefile.am ends here
 
--- /home/cvs/shishi/gl/allocsa.h       2004/04/18 12:10:19     1.1
+++ /home/cvs/shishi/gl/allocsa.h       2004/11/08 14:50:17     1.2
@@ -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 <address@hidden>, 2003.
 
    This program is free software; you can redistribute it and/or modify
@@ -77,6 +77,10 @@
 #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
--- /home/cvs/shishi/gl/getdate.y       2004/10/05 18:54:41     1.6
+++ /home/cvs/shishi/gl/getdate.y       2004/11/08 14:50:17     1.7
@@ -22,16 +22,13 @@
    <address@hidden> and Jim Berets <address@hidden> in August, 1990.
 
    Modified by Paul Eggert <address@hidden> in August 1999 to do
-   the right thing about local DST, and in February 2004 to support
-   nanosecond-resolution time stamps.  Unlike previous versions, this
-   version is reentrant.  */
+   the right thing about local DST.  Also modified by Paul Eggert
+   <address@hidden> in February 2004 to support
+   nanosecond-resolution time stamps, and in October 2004 to support
+   TZ strings in dates.  */
 
 /* FIXME: Check for arithmetic overflow in all cases, not just
-   some of them.
-
-   FIXME: The current code uses 'int' to count seconds; it should use
-   something like 'intmax_t' to support time stamps that don't fit in
-   32 bits.  */
+   some of them.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -53,7 +50,12 @@
 
 #include <ctype.h>
 #include <limits.h>
-#include <stdlib.h> /* for `free'; used by Bison 1.27 */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "setenv.h"
+#include "xalloc.h"
 
 #if STDC_HEADERS || (! defined isascii && ! HAVE_ISASCII)
 # define IN_CTYPE_DOMAIN(c) 1
@@ -64,23 +66,16 @@
 #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
 #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
 #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
 
-/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
+/* ISDIGIT differs from isdigit, as follows:
    - Its arg may be any int or unsigned int; it need not be an unsigned char.
    - It's guaranteed to evaluate its argument exactly once.
    - It's typically faster.
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
-   ISDIGIT_LOCALE unless it's important to use the locale's definition
+   isdigit unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
-#include <string.h>
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-#endif
-
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
 # define __attribute__(x)
 #endif
@@ -166,17 +161,17 @@
   table local_time_zone_table[3];
 } parser_control;
 
-#define PC (* (parser_control *) parm)
-#define YYLEX_PARAM parm
-#define YYPARSE_PARAM parm
-
-static int yyerror ();
-static int yylex ();
+union YYSTYPE;
+static int yylex (union YYSTYPE *, parser_control *);
+static int yyerror (parser_control *, char *);
 
 %}
 
-/* We want a reentrant parser.  */
-%pure_parser
+/* We want a reentrant parser, even if the TZ manipulation and the calls to
+   localtime and gmtime are not reentrant.  */
+%pure-parser
+%parse-param { parser_control *pc }
+%lex-param { parser_control *pc }
 
 /* This grammar has 13 shift/reduce conflicts. */
 %expect 13
@@ -209,8 +204,8 @@
 timespec:
     '@' seconds
       {
-       PC.seconds = $2;
-       PC.timespec_seen = true;
+       pc->seconds = $2;
+       pc->timespec_seen = true;
       }
   ;
 
@@ -221,104 +216,104 @@
 
 item:
     time
-      { PC.times_seen++; }
+      { pc->times_seen++; }
   | local_zone
-      { PC.local_zones_seen++; }
+      { pc->local_zones_seen++; }
   | zone
-      { PC.zones_seen++; }
+      { pc->zones_seen++; }
   | date
-      { PC.dates_seen++; }
+      { pc->dates_seen++; }
   | day
-      { PC.days_seen++; }
+      { pc->days_seen++; }
   | rel
-      { PC.rels_seen++; }
+      { pc->rels_seen++; }
   | number
   ;
 
 time:
     tUNUMBER tMERIDIAN
       {
-       PC.hour = $1.value;
-       PC.minutes = 0;
-       PC.seconds.tv_sec = 0;
-       PC.seconds.tv_nsec = 0;
-       PC.meridian = $2;
+       pc->hour = $1.value;
+       pc->minutes = 0;
+       pc->seconds.tv_sec = 0;
+       pc->seconds.tv_nsec = 0;
+       pc->meridian = $2;
       }
   | tUNUMBER ':' tUNUMBER o_merid
       {
-       PC.hour = $1.value;
-       PC.minutes = $3.value;
-       PC.seconds.tv_sec = 0;
-       PC.seconds.tv_nsec = 0;
-       PC.meridian = $4;
+       pc->hour = $1.value;
+       pc->minutes = $3.value;
+       pc->seconds.tv_sec = 0;
+       pc->seconds.tv_nsec = 0;
+       pc->meridian = $4;
       }
   | tUNUMBER ':' tUNUMBER tSNUMBER
       {
-       PC.hour = $1.value;
-       PC.minutes = $3.value;
-       PC.seconds.tv_sec = 0;
-       PC.seconds.tv_nsec = 0;
-       PC.meridian = MER24;
-       PC.zones_seen++;
-       PC.time_zone = $4.value % 100 + ($4.value / 100) * 60;
+       pc->hour = $1.value;
+       pc->minutes = $3.value;
+       pc->seconds.tv_sec = 0;
+       pc->seconds.tv_nsec = 0;
+       pc->meridian = MER24;
+       pc->zones_seen++;
+       pc->time_zone = $4.value % 100 + ($4.value / 100) * 60;
       }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
       {
-       PC.hour = $1.value;
-       PC.minutes = $3.value;
-       PC.seconds = $5;
-       PC.meridian = $6;
+       pc->hour = $1.value;
+       pc->minutes = $3.value;
+       pc->seconds = $5;
+       pc->meridian = $6;
       }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER
       {
-       PC.hour = $1.value;
-       PC.minutes = $3.value;
-       PC.seconds = $5;
-       PC.meridian = MER24;
-       PC.zones_seen++;
-       PC.time_zone = $6.value % 100 + ($6.value / 100) * 60;
+       pc->hour = $1.value;
+       pc->minutes = $3.value;
+       pc->seconds = $5;
+       pc->meridian = MER24;
+       pc->zones_seen++;
+       pc->time_zone = $6.value % 100 + ($6.value / 100) * 60;
       }
   ;
 
 local_zone:
     tLOCAL_ZONE
-      { PC.local_isdst = $1; }
+      { pc->local_isdst = $1; }
   | tLOCAL_ZONE tDST
-      { PC.local_isdst = $1 < 0 ? 1 : $1 + 1; }
+      { pc->local_isdst = $1 < 0 ? 1 : $1 + 1; }
   ;
 
 zone:
     tZONE
-      { PC.time_zone = $1; }
+      { pc->time_zone = $1; }
   | tDAYZONE
-      { PC.time_zone = $1 + 60; }
+      { pc->time_zone = $1 + 60; }
   | tZONE tDST
-      { PC.time_zone = $1 + 60; }
+      { pc->time_zone = $1 + 60; }
   ;
 
 day:
     tDAY
       {
-       PC.day_ordinal = 1;
-       PC.day_number = $1;
+       pc->day_ordinal = 1;
+       pc->day_number = $1;
       }
   | tDAY ','
       {
-       PC.day_ordinal = 1;
-       PC.day_number = $1;
+       pc->day_ordinal = 1;
+       pc->day_number = $1;
       }
   | tUNUMBER tDAY
       {
-       PC.day_ordinal = $1.value;
-       PC.day_number = $2;
+       pc->day_ordinal = $1.value;
+       pc->day_number = $2;
       }
   ;
 
 date:
     tUNUMBER '/' tUNUMBER
       {
-       PC.month = $1.value;
-       PC.day = $3.value;
+       pc->month = $1.value;
+       pc->day = $3.value;
       }
   | tUNUMBER '/' tUNUMBER '/' tUNUMBER
       {
@@ -329,119 +324,119 @@
           you want portability, use the ISO 8601 format.  */
        if (4 <= $1.digits)
          {
-           PC.year = $1;
-           PC.month = $3.value;
-           PC.day = $5.value;
+           pc->year = $1;
+           pc->month = $3.value;
+           pc->day = $5.value;
          }
        else
          {
-           PC.month = $1.value;
-           PC.day = $3.value;
-           PC.year = $5;
+           pc->month = $1.value;
+           pc->day = $3.value;
+           pc->year = $5;
          }
       }
   | tUNUMBER tSNUMBER tSNUMBER
       {
        /* ISO 8601 format.  YYYY-MM-DD.  */
-       PC.year = $1;
-       PC.month = -$2.value;
-       PC.day = -$3.value;
+       pc->year = $1;
+       pc->month = -$2.value;
+       pc->day = -$3.value;
       }
   | tUNUMBER tMONTH tSNUMBER
       {
        /* e.g. 17-JUN-1992.  */
-       PC.day = $1.value;
-       PC.month = $2;
-       PC.year.value = -$3.value;
-       PC.year.digits = $3.digits;
+       pc->day = $1.value;
+       pc->month = $2;
+       pc->year.value = -$3.value;
+       pc->year.digits = $3.digits;
       }
   | tMONTH tSNUMBER tSNUMBER
       {
        /* e.g. JUN-17-1992.  */
-       PC.month = $1;
-       PC.day = -$2.value;
-       PC.year.value = -$3.value;
-       PC.year.digits = $3.digits;
+       pc->month = $1;
+       pc->day = -$2.value;
+       pc->year.value = -$3.value;
+       pc->year.digits = $3.digits;
       }
   | tMONTH tUNUMBER
       {
-       PC.month = $1;
-       PC.day = $2.value;
+       pc->month = $1;
+       pc->day = $2.value;
       }
   | tMONTH tUNUMBER ',' tUNUMBER
       {
-       PC.month = $1;
-       PC.day = $2.value;
-       PC.year = $4;
+       pc->month = $1;
+       pc->day = $2.value;
+       pc->year = $4;
       }
   | tUNUMBER tMONTH
       {
-       PC.day = $1.value;
-       PC.month = $2;
+       pc->day = $1.value;
+       pc->month = $2;
       }
   | tUNUMBER tMONTH tUNUMBER
       {
-       PC.day = $1.value;
-       PC.month = $2;
-       PC.year = $3;
+       pc->day = $1.value;
+       pc->month = $2;
+       pc->year = $3;
       }
   ;
 
 rel:
     relunit tAGO
       {
-       PC.rel_ns = -PC.rel_ns;
-       PC.rel_seconds = -PC.rel_seconds;
-       PC.rel_minutes = -PC.rel_minutes;
-       PC.rel_hour = -PC.rel_hour;
-       PC.rel_day = -PC.rel_day;
-       PC.rel_month = -PC.rel_month;
-       PC.rel_year = -PC.rel_year;
+       pc->rel_ns = -pc->rel_ns;
+       pc->rel_seconds = -pc->rel_seconds;
+       pc->rel_minutes = -pc->rel_minutes;
+       pc->rel_hour = -pc->rel_hour;
+       pc->rel_day = -pc->rel_day;
+       pc->rel_month = -pc->rel_month;
+       pc->rel_year = -pc->rel_year;
       }
   | relunit
   ;
 
 relunit:
     tUNUMBER tYEAR_UNIT
-      { PC.rel_year += $1.value * $2; }
+      { pc->rel_year += $1.value * $2; }
   | tSNUMBER tYEAR_UNIT
-      { PC.rel_year += $1.value * $2; }
+      { pc->rel_year += $1.value * $2; }
   | tYEAR_UNIT
-      { PC.rel_year += $1; }
+      { pc->rel_year += $1; }
   | tUNUMBER tMONTH_UNIT
-      { PC.rel_month += $1.value * $2; }
+      { pc->rel_month += $1.value * $2; }
   | tSNUMBER tMONTH_UNIT
-      { PC.rel_month += $1.value * $2; }
+      { pc->rel_month += $1.value * $2; }
   | tMONTH_UNIT
-      { PC.rel_month += $1; }
+      { pc->rel_month += $1; }
   | tUNUMBER tDAY_UNIT
-      { PC.rel_day += $1.value * $2; }
+      { pc->rel_day += $1.value * $2; }
   | tSNUMBER tDAY_UNIT
-      { PC.rel_day += $1.value * $2; }
+      { pc->rel_day += $1.value * $2; }
   | tDAY_UNIT
-      { PC.rel_day += $1; }
+      { pc->rel_day += $1; }
   | tUNUMBER tHOUR_UNIT
-      { PC.rel_hour += $1.value * $2; }
+      { pc->rel_hour += $1.value * $2; }
   | tSNUMBER tHOUR_UNIT
-      { PC.rel_hour += $1.value * $2; }
+      { pc->rel_hour += $1.value * $2; }
   | tHOUR_UNIT
-      { PC.rel_hour += $1; }
+      { pc->rel_hour += $1; }
   | tUNUMBER tMINUTE_UNIT

[630 lines skipped]
--- /home/cvs/shishi/gl/getpass.c       2004/10/14 17:59:10     1.3
+++ /home/cvs/shishi/gl/getpass.c       2004/11/08 14:50:17     1.4
@@ -58,16 +58,26 @@
 #elif USE_UNLOCKED_IO
 # include "unlocked-io.h"
 #else
-# undef fflush_unlocked
-# define fflush_unlocked(x) fflush (x)
-# undef flockfile
-# define flockfile(x) ((void) 0)
-# undef funlockfile
-# define funlockfile(x) ((void) 0)
-# undef fputs_unlocked
-# define fputs_unlocked(str,stream) fputs (str, stream)
-# undef putc_unlocked
-# define putc_unlocked(c,stream) putc (c, stream)
+# if !HAVE_DECL_FFLUSH_UNLOCKED
+#  undef fflush_unlocked
+#  define fflush_unlocked(x) fflush (x)
+# endif
+# if !HAVE_DECL_FLOCKFILE
+#  undef flockfile
+#  define flockfile(x) ((void) 0)
+# endif
+# if !HAVE_DECL_FUNLOCKFILE
+#  undef funlockfile
+#  define funlockfile(x) ((void) 0)
+# endif
+# if !HAVE_DECL_FPUTS_UNLOCKED
+#  undef fputs_unlocked
+#  define fputs_unlocked(str,stream) fputs (str, stream)
+# endif
+# if !HAVE_DECL_PUTC_UNLOCKED
+#  undef putc_unlocked
+#  define putc_unlocked(c,stream) putc (c, stream)
+# endif
 #endif
 
 #if _LIBC
--- /home/cvs/shishi/gl/mktime.c        2004/04/18 12:10:19     1.4
+++ /home/cvs/shishi/gl/mktime.c        2004/11/08 14:50:17     1.5
@@ -77,7 +77,7 @@
 
 /* Return 1 if YEAR + TM_YEAR_BASE is a leap year.  */
 static inline int
-leapyear (int year)
+leapyear (long int year)
 {
   /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
      Also, work even if YEAR is negative.  */
@@ -495,7 +495,6 @@
          | (a->tm_mday ^ b->tm_mday)
          | (a->tm_mon ^ b->tm_mon)
          | (a->tm_year ^ b->tm_year)
-         | (a->tm_mday ^ b->tm_mday)
          | (a->tm_yday ^ b->tm_yday)
          | (a->tm_isdst ^ b->tm_isdst));
 }
--- /home/cvs/shishi/gl/readlink.c      2003/11/30 18:59:44     1.1
+++ /home/cvs/shishi/gl/readlink.c      2004/11/08 14:50:17     1.2
@@ -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
 
--- /home/cvs/shishi/gl/setenv.h        2003/08/22 22:59:19     1.2
+++ /home/cvs/shishi/gl/setenv.h        2004/11/08 14:50:17     1.3
@@ -1,5 +1,5 @@
 /* Setting environment variables.
-   Copyright (C) 2001-2003 Free Software Foundation, Inc.
+   Copyright (C) 2001-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
@@ -34,7 +34,15 @@
 
 #endif
 
-#if !HAVE_UNSETENV
+#if HAVE_UNSETENV
+
+# if VOID_UNSETENV
+/* On some systems, unsetenv() returns void.
+   This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
+#  define unsetenv(name) ((unsetenv)(name), 0)
+# endif
+
+#else
 
 /* Remove the variable NAME from the environment.  */
 extern int unsetenv (const char *name);
--- /home/cvs/shishi/gl/xreadlink.c     2004/08/07 14:06:59     1.4
+++ /home/cvs/shishi/gl/xreadlink.c     2004/11/08 14:50:17     1.5
@@ -41,6 +41,8 @@
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
 
+#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX)
+
 #include "xalloc.h"
 
 /* Call readlink to get the symbolic link value of FILENAME.
@@ -56,14 +58,17 @@
 {
   /* The initial buffer size for the link value.  A power of 2
      detects arithmetic overflow earlier, but is not required.  */
-  size_t buf_size = size + 1;
+  size_t buf_size = size < MAXSIZE ? size + 1 : MAXSIZE;
 
   while (1)
     {
       char *buffer = xmalloc (buf_size);
-      ssize_t link_length = readlink (filename, buffer, buf_size);
+      ssize_t r = readlink (filename, buffer, buf_size);
+      size_t link_length = r;
 
-      if (link_length < 0)
+      /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
+        with errno == ERANGE if the buffer is too small.  */
+      if (r < 0 && errno != ERANGE)
        {
          int saved_errno = errno;
          free (buffer);
@@ -71,15 +76,18 @@
          return NULL;
        }
 
-      if ((size_t) link_length < buf_size)
+      if (link_length < buf_size)
        {
          buffer[link_length] = 0;
          return buffer;
        }
 
       free (buffer);
-      buf_size *= 2;
-      if (! (0 < buf_size && buf_size <= SSIZE_MAX))
+      if (buf_size <= MAXSIZE / 2)
+       buf_size *= 2;
+      else if (buf_size < MAXSIZE)
+       buf_size = MAXSIZE;
+      else
        xalloc_die ();
     }
 }

--- /home/cvs/shishi/gl/allocsa.valgrind        2004/11/08 14:50:18     NONE
+++ /home/cvs/shishi/gl/allocsa.valgrind        2004/11/08 14:50:18     1.1
# Suppress a valgrind message about use of uninitialized memory in freesa().
# This use is OK because it provides only a speedup.
{
    freesa
    Memcheck:Cond
    fun:freesa
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]