summaryrefslogtreecommitdiffstats
path: root/gnulib-local
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-01-14 10:54:19 +0100
committerBruno Haible <bruno@clisp.org>2010-01-14 10:54:19 +0100
commit2593357be0a21fc9604987bea6dfe12e3b8f9959 (patch)
tree676b8a7ac5492570248008e6251566a229e07a6c /gnulib-local
parent98ec9caf67c053da44fba2d5ee5616e60a478ae2 (diff)
downloadexternal_gettext-2593357be0a21fc9604987bea6dfe12e3b8f9959.zip
external_gettext-2593357be0a21fc9604987bea6dfe12e3b8f9959.tar.gz
external_gettext-2593357be0a21fc9604987bea6dfe12e3b8f9959.tar.bz2
Use full 'vasnprintf' module from gnulib.
Diffstat (limited to 'gnulib-local')
-rw-r--r--gnulib-local/ChangeLog10
-rw-r--r--gnulib-local/Makefile.am5
-rw-r--r--gnulib-local/lib/vasprintf.c182
-rw-r--r--gnulib-local/m4/vasprintf.m432
-rw-r--r--gnulib-local/modules/vasprintf.diff28
5 files changed, 11 insertions, 246 deletions
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index ee17f9c..f595798 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,3 +1,13 @@
+2010-01-14 Bruno Haible <bruno@clisp.org>
+
+ Use full 'vasnprintf' module from gnulib. The reduced one did not
+ support NULL arguments.
+ * lib/vasprintf.c: Remove file.
+ * m4/vasprintf.m4: Remove file.
+ * modules/vasprintf.diff: Remove file.
+ * Makefile.am (EXTRA_DIST): Remove them.
+ Reported by LRN at <http://savannah.gnu.org/bugs/?28593>.
+
2010-01-11 Bruno Haible <bruno@clisp.org>
* modules/html-ostream (Depends-on): Remove utf8-ucs4. Instead add
diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am
index 2a08fcf..8f583c0 100644
--- a/gnulib-local/Makefile.am
+++ b/gnulib-local/Makefile.am
@@ -1,5 +1,5 @@
## Makefile for the gnulib-local directory of GNU gettext
-## Copyright (C) 2006-2008 Free Software Foundation, Inc.
+## Copyright (C) 2006-2008, 2010 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
@@ -232,7 +232,6 @@ lib/termcap.h \
lib/terminfo.h \
lib/tparm.c \
lib/tputs.c \
-lib/vasprintf.c \
lib/xalloc.h \
lib/xerror.c \
lib/xerror.h \
@@ -259,7 +258,6 @@ m4/termcap.m4 \
m4/terminfo.m4 \
m4/term-ostream.m4 \
m4/unionwait.m4 \
-m4/vasprintf.m4 \
modules/backupfile \
modules/basename \
modules/closeout \
@@ -293,7 +291,6 @@ modules/terminfo-h \
modules/term-ostream \
modules/term-ostream-tests \
modules/term-styled-ostream \
-modules/vasprintf.diff \
modules/wait-process.diff \
modules/xalloc \
modules/xalloc-die \
diff --git a/gnulib-local/lib/vasprintf.c b/gnulib-local/lib/vasprintf.c
deleted file mode 100644
index f825c4e..0000000
--- a/gnulib-local/lib/vasprintf.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Like vsprintf but provides a pointer to malloc'd storage, which must
- be freed by the caller.
- Copyright (C) 1994, 1998-1999, 2000-2003, 2006-2007 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <math.h>
-
-#ifdef TEST
-size_t global_total_width;
-#endif
-
-static int
-int_vasprintf (char **result, const char *format, va_list args)
-{
- const char *p = format;
- /* Add one to make sure that it is never zero, which might cause malloc
- to return NULL. */
- size_t total_width = strlen (format) + 1;
- va_list ap;
-
- va_copy (ap, args);
- while (*p != '\0')
- {
- if (*p++ == '%')
- {
- while (strchr ("-+ #0", *p))
- ++p;
- if (*p == '*')
- {
- ++p;
- total_width += abs (va_arg (ap, int));
- }
- else
- total_width += strtoul (p, (char **) &p, 10);
- if (*p == '.')
- {
- ++p;
- if (*p == '*')
- {
- ++p;
- total_width += abs (va_arg (ap, int));
- }
- else
- total_width += strtoul (p, (char **) &p, 10);
- }
- while (strchr ("hlLjtz", *p))
- ++p;
- /* Should be big enough for any format specifier except %s
- and floats. */
- total_width += 30;
- switch (*p)
- {
- case 'd':
- case 'i':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- case 'c':
- (void) va_arg (ap, int);
- break;
- case 'f':
- case 'F':
- {
- double arg = va_arg (ap, double);
- if (arg >= 1.0 || arg <= -1.0)
- /* Since an ieee double can have an exponent of 307, we'll
- make the buffer wide enough to cover the gross case. */
- total_width += 307;
- }
- break;
- case 'e':
- case 'E':
- case 'g':
- case 'G':
- (void) va_arg (ap, double);
- break;
- case 's':
- total_width += strlen (va_arg (ap, char *));
- break;
- case 'p':
- case 'n':
- (void) va_arg (ap, char *);
- break;
- }
- p++;
- }
- }
- va_end (ap);
-
-#ifdef TEST
- global_total_width = total_width;
-#endif
- *result = malloc (total_width);
- if (*result != NULL)
- return vsprintf (*result, format, args);
- else
- return -1;
-}
-
-int
-vasprintf (char **result, const char *format, va_list args)
-{
- return int_vasprintf (result, format, args);
-}
-
-int
-asprintf (char **result, const char *format, ...)
-{
- va_list args;
- int done;
-
- va_start (args, format);
- done = vasprintf (result, format, args);
- va_end (args);
-
- return done;
-}
-
-/* ========================= test program ========================= */
-
-#ifdef TEST
-
-#include <float.h>
-
-void
-checkit (const char* format, ...)
-{
- va_list args;
- char *result;
-
- va_start (args, format);
- vasprintf (&result, format, args);
- va_end (args);
- if (strlen (result) < global_total_width)
- printf ("PASS: ");
- else
- printf ("FAIL: ");
- printf ("%lu %s\n", (unsigned long) global_total_width, result);
-}
-
-int
-main ()
-{
- checkit ("%d", 0x12345678);
- checkit ("%200d", 5);
- checkit ("%.300d", 6);
- checkit ("%100.150d", 7);
- checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
-777777777777777777333333333333366666666666622222222222777777777777733333");
- checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
- checkit ("%e", DBL_MIN);
- checkit ("%e", DBL_MAX);
- checkit ("%.400f", DBL_MIN);
- checkit ("%f", DBL_MAX);
- checkit ("%g", DBL_MIN);
- checkit ("%g", DBL_MAX);
- return 0;
-}
-
-#endif /* TEST */
diff --git a/gnulib-local/m4/vasprintf.m4 b/gnulib-local/m4/vasprintf.m4
deleted file mode 100644
index 80ad721..0000000
--- a/gnulib-local/m4/vasprintf.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# vasprintf.m4 serial 2
-dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_VASPRINTF],
-[
- AC_CHECK_FUNCS([vasprintf])
- if test $ac_cv_func_vasprintf = no; then
- gl_REPLACE_VASPRINTF
- fi
-])
-
-AC_DEFUN([gl_REPLACE_VASPRINTF],
-[
- AC_LIBOBJ([vasprintf])
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- if test $ac_cv_func_vasprintf = yes; then
- REPLACE_VASPRINTF=1
- else
- HAVE_VASPRINTF=0
- fi
- gl_PREREQ_VASPRINTF_H
-])
-
-# Prerequisites of the vasprintf portion of lib/stdio.h.
-AC_DEFUN([gl_PREREQ_VASPRINTF_H],
-[
- dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf().
- AC_REQUIRE([AC_GNU_SOURCE])
-])
diff --git a/gnulib-local/modules/vasprintf.diff b/gnulib-local/modules/vasprintf.diff
deleted file mode 100644
index 2769843..0000000
--- a/gnulib-local/modules/vasprintf.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-*** vasprintf.orig 2007-09-19 00:04:41.000000000 +0200
---- vasprintf 2007-09-25 00:54:11.000000000 +0200
-***************
-*** 3,14 ****
-
- Files:
- lib/vasprintf.c
-- lib/asprintf.c
- m4/vasprintf.m4
-
- Depends-on:
- extensions
-! vasnprintf
- stdio
-
- configure.ac:
---- 3,13 ----
-
- Files:
- lib/vasprintf.c
- m4/vasprintf.m4
-
- Depends-on:
- extensions
-! stdarg
- stdio
-
- configure.ac: