]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update from gnulib.
authorBruno Haible <bruno@clisp.org>
Tue, 11 Jan 2005 13:00:09 +0000 (13:00 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:59 +0000 (12:11 +0200)
15 files changed:
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/vasnprintf.c
gettext-runtime/intl/vasnprintf.h
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/vasnprintf.c
gettext-runtime/libasprintf/vasnprintf.h
gettext-runtime/libasprintf/vasprintf.c
gettext-runtime/libasprintf/vasprintf.h
gettext-runtime/m4/ChangeLog
gettext-runtime/m4/longlong.m4
gettext-runtime/m4/ulonglong.m4
gettext-tools/lib/ChangeLog
gettext-tools/lib/setenv.c
gettext-tools/lib/setenv.h
gettext-tools/m4/ChangeLog

index ae5b24cfde18c9292f6f6ba3fa781783abae399b..64c19b41ef208c320347309d21dfa11b0ffb77fa 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-08  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length
+       is > INT_MAX.
+
 2005-01-01  Bruno Haible  <bruno@clisp.org>
 
        * dcigettext.c (guess_category_value): Let the environment variables
index fc4a23039f783f5ee69367236376aa88dd3df0b6..8f2cc8484f545c507d89deddcd57e97e9f04aa61 100644 (file)
@@ -41,7 +41,7 @@
 #include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
 #include <string.h>    /* memcpy(), strlen() */
 #include <errno.h>     /* errno */
-#include <limits.h>    /* CHAR_BIT */
+#include <limits.h>    /* CHAR_BIT, INT_MAX */
 #include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
 #if WIDE_CHAR_VERSION
 # include "wprintf-parse.h"
@@ -863,8 +863,19 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
       free (buf_malloced);
     CLEANUP ();
     *lengthp = length;
+    if (length > INT_MAX)
+      goto length_overflow;
     return result;
 
+  length_overflow:
+    /* We could produce such a big string, but its length doesn't fit into
+       an 'int'.  POSIX says that snprintf() fails with errno = EOVERFLOW in
+       this case.  */
+    if (result != resultbuf)
+      free (result);
+    errno = EOVERFLOW;
+    return NULL;
+
   out_of_memory:
     if (!(result == resultbuf || result == NULL))
       free (result);
index 65f1bc13dd2cbcd2ea693c7b26100e455ac8284f..84da20813eed1ab8e93adf93bde70a7042836d7c 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
@@ -48,7 +48,24 @@ extern "C" {
    If successful, return the address of the string (this may be = RESULTBUF
    if no dynamic memory allocation was necessary) and set *LENGTHP to the
    number of resulting bytes, excluding the trailing NUL.  Upon error, set
-   errno and return NULL.  */
+   errno and return NULL.
+
+   When dynamic memory allocation occurs, the preallocated buffer is left
+   alone (with possibly modified contents).  This makes it possible to use
+   a statically allocated or stack-allocated buffer, like this:
+
+          char buf[100];
+          size_t len = sizeof (buf);
+          char *output = vasnprintf (buf, &len, format, args);
+          if (output == NULL)
+            ... error handling ...;
+          else
+            {
+              ... use the output string ...;
+              if (output != buf)
+                free (output);
+            }
+  */
 extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 3, 4)));
 extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
index 7d39b6985c862500194817d9e633c3672c541bfe..3a42ec101252db697c7ef1c8b13b60f42a611d9d 100644 (file)
@@ -2,6 +2,12 @@
 
        * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
 
+2004-09-08  Bruno Haible  <bruno@clisp.org>
+
+       * vasnprintf.c (VASNPRINTF): Signal EOVERFLOW if the resulting length
+       is > INT_MAX.
+       * vasprintf.c (vasprintf): Don't test for length > INT_MAX any more.
+
 2004-05-14  Bruno Haible  <bruno@clisp.org>
 
        * vasnprintf.c (VASNPRINTF): Correctly handle the case of a precision
index fc4a23039f783f5ee69367236376aa88dd3df0b6..8f2cc8484f545c507d89deddcd57e97e9f04aa61 100644 (file)
@@ -41,7 +41,7 @@
 #include <stdlib.h>    /* abort(), malloc(), realloc(), free() */
 #include <string.h>    /* memcpy(), strlen() */
 #include <errno.h>     /* errno */
-#include <limits.h>    /* CHAR_BIT */
+#include <limits.h>    /* CHAR_BIT, INT_MAX */
 #include <float.h>     /* DBL_MAX_EXP, LDBL_MAX_EXP */
 #if WIDE_CHAR_VERSION
 # include "wprintf-parse.h"
@@ -863,8 +863,19 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
       free (buf_malloced);
     CLEANUP ();
     *lengthp = length;
+    if (length > INT_MAX)
+      goto length_overflow;
     return result;
 
+  length_overflow:
+    /* We could produce such a big string, but its length doesn't fit into
+       an 'int'.  POSIX says that snprintf() fails with errno = EOVERFLOW in
+       this case.  */
+    if (result != resultbuf)
+      free (result);
+    errno = EOVERFLOW;
+    return NULL;
+
   out_of_memory:
     if (!(result == resultbuf || result == NULL))
       free (result);
index 65f1bc13dd2cbcd2ea693c7b26100e455ac8284f..84da20813eed1ab8e93adf93bde70a7042836d7c 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
@@ -48,7 +48,24 @@ extern "C" {
    If successful, return the address of the string (this may be = RESULTBUF
    if no dynamic memory allocation was necessary) and set *LENGTHP to the
    number of resulting bytes, excluding the trailing NUL.  Upon error, set
-   errno and return NULL.  */
+   errno and return NULL.
+
+   When dynamic memory allocation occurs, the preallocated buffer is left
+   alone (with possibly modified contents).  This makes it possible to use
+   a statically allocated or stack-allocated buffer, like this:
+
+          char buf[100];
+          size_t len = sizeof (buf);
+          char *output = vasnprintf (buf, &len, format, args);
+          if (output == NULL)
+            ... error handling ...;
+          else
+            {
+              ... use the output string ...;
+              if (output != buf)
+                free (output);
+            }
+  */
 extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 3, 4)));
 extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
index d20f8ca6319bcbec2b2090409db72faf91193b3a..fb88f19283d6f4716026c507ccd008adbf273e87 100644 (file)
@@ -23,7 +23,6 @@
 /* Specification.  */
 #include "vasprintf.h"
 
-#include <limits.h>
 #include <stdlib.h>
 
 #include "vasnprintf.h"
@@ -35,15 +34,10 @@ vasprintf (char **resultp, const char *format, va_list args)
   char *result = vasnprintf (NULL, &length, format, args);
   if (result == NULL)
     return -1;
-  if (length > INT_MAX)
-    {
-      /* We could produce such a big string, but can't return its length
-        as an 'int'.  */
-      free (result);
-      return -1;
-    }
 
   *resultp = result;
-  /* Return the number of resulting bytes, excluding the trailing NUL.  */
+  /* Return the number of resulting bytes, excluding the trailing NUL.
+     If it wouldn't fit in an 'int', vasnprintf() would have returned NULL
+     and set errno to EOVERFLOW.  */
   return length;
 }
index c82d7b7bb95615dbdef1e5ba174dce5d8f4412ee..fc128031e9eb5f0cc8bfdb99f1bd1a266c22e4c5 100644 (file)
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
 extern "C" {
 #endif
 
+/* Write formatted output to a string dynamically allocated with malloc().
+   If the memory allocation succeeds, store the address of the string in
+   *RESULT and return the number of resulting bytes, excluding the trailing
+   NUL.  Upon memory allocation error, or some other error, return -1.  */
 extern int asprintf (char **result, const char *format, ...)
        __attribute__ ((__format__ (__printf__, 2, 3)));
 extern int vasprintf (char **result, const char *format, va_list args)
index da472d859e90d87849e4c3391b4b7f8935cf1727..d168dfef532e3f5cf0315e64dbeae51f2d43200a 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * longlong.m4, ulonglong.m4: Fix copyright date and/or serial number.
+
 2004-09-05  Bruno Haible  <bruno@clisp.org>
 
        * gettext.m4 (AM_INTL_SUBDIR): Test for CFPreferencesCopyAppValue.
index 698d2ae7ba3047aff8723d7eeb4059c31ec2b6f6..028422b6121af68a51152c5aaf549133e4da3d77 100644 (file)
@@ -1,5 +1,5 @@
 # longlong.m4 serial 5
-dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
index 3c7c5f03d71bffb0f05eacfe72c590a474a71108..1123ccb8372c6b7f4fce80b51c8e53b723bd23a7 100644 (file)
@@ -1,5 +1,5 @@
 # ulonglong.m4 serial 4
-dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
index 997ac31b21aa74d824da90488d939695b09f828d..7b758adcbf63a31403ebe6dec597aaf1988fd0ae 100644 (file)
@@ -2,6 +2,19 @@
 
        * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H.
 
+2004-11-02  Bruno Haible  <bruno@clisp.org>
+
+       * setenv.h (unsetenv): Define as a macro if the system's unsetenv()
+       function returns void.
+
+2003-09-08  Paul Eggert  <eggert@twinsun.com>
+
+       * atexit.c (atexit): Define using a prototype.
+
+2004-08-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * setenv.c: Import changes from coreutils.
+
 2004-12-10  Bruno Haible  <bruno@clisp.org>
 
        * obstack.h: Update from current gnulib version.
index 55b9bf2da1638c04246fca584e48a2f6358accd7..c06fec4ebb341eb9d4bce5616b7ed7385f88ac75 100644 (file)
 #include <alloca.h>
 
 #include <errno.h>
-#if !_LIBC
-# if !defined errno && !defined HAVE_ERRNO_DECL
-extern int errno;
-# endif
+#ifndef __set_errno
 # define __set_errno(ev) ((errno) = (ev))
 #endif
 
index 9068b70ff2320e6a223dec9a5e83db7ab2fc2799..7ac5ae645a8f9a311168f2d5c121542966b8108b 100644 (file)
@@ -1,5 +1,5 @@
 /* Setting environment variables.
-   Copyright (C) 2001-2002 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
@@ -18,7 +18,7 @@
 #if HAVE_SETENV || HAVE_UNSETENV
 
 /* Get setenv(), unsetenv() declarations.  */
-#include <stdlib.h>
+# include <stdlib.h>
 
 #endif
 
@@ -34,7 +34,15 @@ extern int setenv (const char *name, const char *value, int replace);
 
 #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);
index 44c525d5665361f9f353aca8271981da8be9593f..f234bdcb13ecd51e22446dd9fbbd34b8bee178b0 100644 (file)
@@ -1,3 +1,46 @@
+2005-01-06  Bruno Haible  <bruno@clisp.org>
+
+       * stdbool.m4: Upgrade to gnulib version.
+
+2004-11-02  Bruno Haible  <bruno@clisp.org>
+
+       * setenv.m4 (gt_FUNC_SETENV): Define VOID_UNSETENV if unsetenv()
+       returns void.
+
+2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * unlocked-io.m4: Add copyright notice.
+       (gl_FUNC_GLIBC_UNLOCKED_IO): Define USE_UNLOCKED_IO.
+
+2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * quotearg.m4: Fix copyright date and/or serial number.
+
+2003-11-24  Bruno Haible  <bruno@clisp.org>
+
+       * allocsa.m4 (gl_ALLOCSA): Require also gl_AC_TYPE_LONG_LONG and
+       gt_TYPE_LONGDOUBLE.
+
+2003-09-17  Paul Eggert  <eggert@twinsun.com>
+
+       * extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Call AC_BEFORE first,
+       to avoid spurious warnings like "AC_RUN_IFELSE was called before
+       gl_USE_SYSTEM_EXTENSIONS" from autoreconf.
+
+2003-09-12  Paul Eggert  <eggert@twinsun.com>
+
+       * extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Require AC_AIX
+       and AC_MINIX, too, so that their extensions are available.
+
+2003-09-10  Bruno Haible  <bruno@clisp.org>
+
+       * xreadlink.m4 (gl_XREADLINK): Remove <stdlib.h> check.
+
+2003-09-10  Bruno Haible  <bruno@clisp.org>
+
+       * setenv.m4 (gl_PREREQ_SETENV, gl_PREREQ_UNSETENV): Remove
+       <stdlib.h> and <string.h> checks.
+
 2004-04-26  Bruno Haible  <bruno@clisp.org>
 
        * csharpcomp.m4 (gt_CSHARPCOMP): Avoid using !.