]> mj.ucw.cz Git - libucw.git/blobdiff - lib/ff-printf.c
First bits of installation of .pc files.
[libucw.git] / lib / ff-printf.c
index aff49eb24de203606553f18edf4b81ae1da69c68..0493092e6a0f4f57c482dee64f2f2abc0f43eb4d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     UCW Library -- Printf on Fastbuf Streams
  *
- *     (c) 2002 Martin Mares <mj@ucw.cz>
+ *     (c) 2002--2005 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
 #include "lib/lib.h"
 #include "lib/fastbuf.h"
 
+#include <stdio.h>
 #include <alloca.h>
 
 int
-vbprintf(struct fastbuf *b, char *msg, va_list args)
+vbprintf(struct fastbuf *b, const char *msg, va_list args)
 {
   byte *buf;
   int len, r;
@@ -24,6 +25,7 @@ vbprintf(struct fastbuf *b, char *msg, va_list args)
     {
       va_copy(args2, args);
       r = vsnprintf(buf, len, msg, args2);
+      va_end(args2);
       if (r < 0)
        len = 256;
       else if (r < len)
@@ -42,6 +44,7 @@ vbprintf(struct fastbuf *b, char *msg, va_list args)
       buf = alloca(len);
       va_copy(args2, args);
       r = vsnprintf(buf, len, msg, args2);
+      va_end(args2);
       if (r < 0)
        len += len;
       else if (r < len)
@@ -55,7 +58,7 @@ vbprintf(struct fastbuf *b, char *msg, va_list args)
 }
 
 int
-bprintf(struct fastbuf *b, char *msg, ...)
+bprintf(struct fastbuf *b, const char *msg, ...)
 {
   va_list args;
   int res;