summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dynbuf.c28
-rw-r--r--lib/dynbuf.h4
2 files changed, 24 insertions, 8 deletions
diff --git a/lib/dynbuf.c b/lib/dynbuf.c
index 2dace3428..b2465b888 100644
--- a/lib/dynbuf.c
+++ b/lib/dynbuf.c
@@ -177,24 +177,22 @@ CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
}
/*
- * Append a string printf()-style
+ * Append a string vprintf()-style
*/
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
{
- va_list ap;
#ifdef BUILDING_LIBCURL
int rc;
- va_start(ap, fmt);
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
rc = Curl_dyn_vprintf(s, fmt, ap);
- va_end(ap);
if(!rc)
return CURLE_OK;
#else
char *str;
- va_start(ap, fmt);
str = vaprintf(fmt, ap); /* this allocs a new string to append */
- va_end(ap);
if(str) {
CURLcode result = dyn_nappend(s, (unsigned char *)str, strlen(str));
@@ -207,7 +205,21 @@ CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
return CURLE_OUT_OF_MEMORY;
}
-
+/*
+ * Append a string printf()-style
+ */
+CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+{
+ CURLcode result;
+ va_list ap;
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ va_start(ap, fmt);
+ result = Curl_dyn_vaddf(s, fmt, ap);
+ va_end(ap);
+ return result;
+}
/*
* Returns a pointer to the buffer.
diff --git a/lib/dynbuf.h b/lib/dynbuf.h
index 94b5dbf68..90a4f6622 100644
--- a/lib/dynbuf.h
+++ b/lib/dynbuf.h
@@ -29,6 +29,7 @@
#define Curl_dyn_add(a,b) curlx_dyn_add(a,b)
#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c)
#define Curl_dyn_addf curlx_dyn_addf
+#define Curl_dyn_vaddf curlx_dyn_vaddf
#define Curl_dyn_free(a) curlx_dyn_free(a)
#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
@@ -56,6 +57,8 @@ CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
WARN_UNUSED_RESULT;
CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
WARN_UNUSED_RESULT;
+CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
+ WARN_UNUSED_RESULT;
void Curl_dyn_reset(struct dynbuf *s);
CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail);
char *Curl_dyn_ptr(const struct dynbuf *s);
@@ -80,4 +83,5 @@ int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
#define DYN_PROXY_CONNECT_HEADERS 16384
#define DYN_QLOG_NAME 1024
#define DYN_H1_TRAILER 4096
+#define DYN_PINGPPONG_CMD (64*1024)
#endif