[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] Re: snprintf
From: |
Simon Josefsson |
Subject: |
[Bug-gnulib] Re: snprintf |
Date: |
Fri, 01 Oct 2004 01:53:39 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
Paul Eggert <address@hidden> writes:
> I installed your patch, except with this change to MODULES.html.sh instead,
> since snprintf is indeed part of C99.
And with the patch below it might even compile... Sorry about that.
Thanks.
PS. These '/* Get X. */' comments feel a bit overworked...
Index: snprintf.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/snprintf.c,v
retrieving revision 1.1
diff -u -p -u -w -r1.1 snprintf.c
--- snprintf.c 30 Sep 2004 23:29:25 -0000 1.1
+++ snprintf.c 30 Sep 2004 23:52:18 -0000
@@ -20,6 +20,15 @@
# include <config.h>
#endif
+/* Get va_list, va_start, va_end. */
+#include <stdarg.h>
+
+/* Get memcpy, size_t. */
+#include <string.h>
+
+/* Get free. */
+#include <stdlib.h>
+
/* Get specification. */
#include "snprintf.h"
@@ -37,8 +46,13 @@
int
snprintf (char *str, size_t size, const char *format, ...)
{
+ char *out;
size_t len;
- char *out = vasnprintf (NULL, &len, format, args);
+ va_list ap;
+
+ va_start(ap, format);
+ out = vasnprintf (NULL, &len, format, ap);
+ va_end(ap);
if (!out)
return -1;
- [Bug-gnulib] vasnprintf problem, Simon Josefsson, 2004/09/21
- Re: [Bug-gnulib] vasnprintf problem, Bruno Haible, 2004/09/21
- [Bug-gnulib] snprintf (was: Re: vasnprintf problem), Simon Josefsson, 2004/09/21
- Re: [Bug-gnulib] snprintf (was: Re: vasnprintf problem), Bruno Haible, 2004/09/21
- [Bug-gnulib] Re: snprintf, Simon Josefsson, 2004/09/21
- [Bug-gnulib] Re: snprintf, Simon Josefsson, 2004/09/30
- Re: [Bug-gnulib] Re: snprintf, Paul Eggert, 2004/09/30
- [Bug-gnulib] Re: snprintf,
Simon Josefsson <=
- [Bug-gnulib] Re: snprintf, Simon Josefsson, 2004/09/30