mirror of
https://github.com/curl/curl.git
synced 2026-08-25 12:03:39 +03:00
dynbuf: make *addf() not require extra mallocs
... by introducing a printf() function that appends directly into a dynbuf: Curl_dyn_vprintf(). This avoids the mandatory extra malloc so if the buffer is already big enough it can just printf directly into it. Since this less-malloc version requires tthe use of a library internal printf function, we only provide this version when building libcurl and not for the dynbuf code that is used when building the curl tool. Closes #5998
This commit is contained in:
parent
2355857702
commit
7e8561e030
4 changed files with 45 additions and 18 deletions
|
|
@ -62,6 +62,10 @@ char *Curl_dyn_ptr(const struct dynbuf *s);
|
|||
unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
|
||||
size_t Curl_dyn_len(const struct dynbuf *s);
|
||||
|
||||
/* returns 0 on success, -1 on error */
|
||||
/* The implementation of this function exists in mprintf.c */
|
||||
int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
|
||||
|
||||
/* Dynamic buffer max sizes */
|
||||
#define DYN_DOH_RESPONSE 3000
|
||||
#define DYN_DOH_CNAME 256
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue