summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-03-27 20:18:17 +0000
committerSimon Josefsson <simon@josefsson.org>2007-03-27 20:18:17 +0000
commit6e2afe5ad7c90ae9422ae2657dd842deed21731e (patch)
tree763903feefd4c2c40d1a5556ab504100d573a226 /lib
parent968e64725705da1084e3122127debacfc96e1fe9 (diff)
downloadgnulib-6e2afe5ad7c90ae9422ae2657dd842deed21731e.tar.gz
Move vasprintf prototypes to stdio.
Diffstat (limited to 'lib')
-rw-r--r--lib/asprintf.c4
-rw-r--r--lib/stdio_.h16
-rw-r--r--lib/vasprintf.c4
-rw-r--r--lib/vasprintf.h69
-rw-r--r--lib/xvasprintf.c4
5 files changed, 22 insertions, 75 deletions
diff --git a/lib/asprintf.c b/lib/asprintf.c
index 29ac6cf2d1..78849549df 100644
--- a/lib/asprintf.c
+++ b/lib/asprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 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
@@ -18,7 +18,7 @@
#include <config.h>
/* Specification. */
-#include "vasprintf.h"
+#include <stdio.h>
#include <stdarg.h>
diff --git a/lib/stdio_.h b/lib/stdio_.h
index 441c0d5cdf..183cf7fe06 100644
--- a/lib/stdio_.h
+++ b/lib/stdio_.h
@@ -183,6 +183,22 @@ extern int vsprintf (char *str, const char *format, va_list args)
vsprintf (b, f, a))
#endif
+#if @GNULIB_VASPRINTF@
+# if @REPLACE_VASPRINTF@
+# define asprintf rpl_asprintf
+# define vasprintf rpl_vasprintf
+# endif
+# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
+ /* 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)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#endif
#ifdef __cplusplus
}
diff --git a/lib/vasprintf.c b/lib/vasprintf.c
index 824707345a..885d1e5639 100644
--- a/lib/vasprintf.c
+++ b/lib/vasprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 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
@@ -18,7 +18,7 @@
#include <config.h>
/* Specification. */
-#include "vasprintf.h"
+#include <stdio.h>
#include <errno.h>
#include <limits.h>
diff --git a/lib/vasprintf.h b/lib/vasprintf.h
deleted file mode 100644
index 65f05315fe..0000000000
--- a/lib/vasprintf.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2003, 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 2, 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _VASPRINTF_H
-#define _VASPRINTF_H
-
-#if HAVE_VASPRINTF
-
-/* Get asprintf(), vasprintf() declarations. */
-#include <stdio.h>
-
-#endif
-
-#if !HAVE_VASPRINTF || REPLACE_VASPRINTF
-
-/* Get va_list. */
-#include <stdarg.h>
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-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. */
-#if REPLACE_VASPRINTF
-# define asprintf rpl_asprintf
-# define vasprintf rpl_vasprintf
-#endif
-extern int asprintf (char **result, const char *format, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
-extern int vasprintf (char **result, const char *format, va_list args)
- __attribute__ ((__format__ (__printf__, 2, 0)));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-#endif /* _VASPRINTF_H */
diff --git a/lib/xvasprintf.c b/lib/xvasprintf.c
index b68442764d..bd683627ef 100644
--- a/lib/xvasprintf.c
+++ b/lib/xvasprintf.c
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2004, 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
@@ -23,8 +23,8 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
+#include <stdio.h>
-#include "vasprintf.h"
#include "xalloc.h"
/* Checked size_t computations. */