]> git.lizzy.rs Git - zlib.git/commitdiff
Add gzvprintf() as an undocumented function in zlib.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 23 Mar 2013 01:32:37 +0000 (18:32 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 23 Mar 2013 01:32:37 +0000 (18:32 -0700)
The function is only available if stdarg.h is available.

gzwrite.c
zconf.h
zconf.h.cmakein
zconf.h.in
zlib.h

index 1b06cdd104f85f1b0089a69d0459a82bdb2554a9..039225bd1da696b041335b9c594635ce7ad0b53b 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -307,12 +307,11 @@ int ZEXPORT gzputs(file, str)
 #include <stdarg.h>
 
 /* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
+int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
 {
     int size, len;
     gz_statep state;
     z_streamp strm;
-    va_list va;
 
     /* get internal structure */
     if (file == NULL)
@@ -342,25 +341,20 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
     /* do the printf() into the input buffer, put length in len */
     size = (int)(state->size);
     state->in[size - 1] = 0;
-    va_start(va, format);
 #ifdef NO_vsnprintf
 #  ifdef HAS_vsprintf_void
     (void)vsprintf((char *)(state->in), format, va);
-    va_end(va);
     for (len = 0; len < size; len++)
         if (state->in[len] == 0) break;
 #  else
     len = vsprintf((char *)(state->in), format, va);
-    va_end(va);
 #  endif
 #else
 #  ifdef HAS_vsnprintf_void
     (void)vsnprintf((char *)(state->in), size, format, va);
-    va_end(va);
     len = strlen((char *)(state->in));
 #  else
     len = vsnprintf((char *)(state->in), size, format, va);
-    va_end(va);
 #  endif
 #endif
 
@@ -375,6 +369,17 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
     return len;
 }
 
+int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
+{
+    va_list va;
+    int ret;
+
+    va_start(va, format);
+    ret = gzvprintf(file, format, va);
+    va_end(va);
+    return ret;
+}
+
 #else /* !STDC && !Z_HAVE_STDARG_H */
 
 /* -- see zlib.h -- */
diff --git a/zconf.h b/zconf.h
index 76aba96a5b7796dcbd0d443ba9d2e5a13099bebf..95c9ef648bad76605759d39759978915f308b9af 100644 (file)
--- a/zconf.h
+++ b/zconf.h
@@ -427,6 +427,12 @@ typedef uLong FAR uLongf;
 #  endif
 #endif
 
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+#    include <stdarg.h>         /* for va_list */
+#  endif
+#endif
+
 #ifdef _WIN32
 #  ifndef Z_SOLO
 #    include <stddef.h>         /* for wchar_t */
index 8f1956c21f99bcaaec8ed59aeb3e294269faf55b..028be15f98fa11d05e0a47159aa928cefaea6728 100644 (file)
@@ -429,6 +429,12 @@ typedef uLong FAR uLongf;
 #  endif
 #endif
 
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+#    include <stdarg.h>         /* for va_list */
+#  endif
+#endif
+
 #ifdef _WIN32
 #  ifndef Z_SOLO
 #    include <stddef.h>         /* for wchar_t */
index 76aba96a5b7796dcbd0d443ba9d2e5a13099bebf..95c9ef648bad76605759d39759978915f308b9af 100644 (file)
@@ -427,6 +427,12 @@ typedef uLong FAR uLongf;
 #  endif
 #endif
 
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+#    include <stdarg.h>         /* for va_list */
+#  endif
+#endif
+
 #ifdef _WIN32
 #  ifndef Z_SOLO
 #    include <stddef.h>         /* for wchar_t */
diff --git a/zlib.h b/zlib.h
index ee38237b00c3a5cf5691dc671756688bbf79490d..e3f11eb7e4553dc819e99d86313f1c25a73bc29c 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1753,6 +1753,12 @@ ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
 ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
                                             const char *mode));
 #endif
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, const char *format,
+                                       va_list va));
+#  endif
+#endif
 
 #ifdef __cplusplus
 }