[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 126/411: dynbuf: provide curlx_ names for reuse by the curl tool
From: |
gnunet |
Subject: |
[gnurl] 126/411: dynbuf: provide curlx_ names for reuse by the curl tool |
Date: |
Wed, 13 Jan 2021 01:19:01 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit c4ea71ae3235cca8c6837f48664d587e52eb32d2
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Wed Sep 9 15:41:05 2020 +0200
dynbuf: provide curlx_ names for reuse by the curl tool
Closes #5946
---
lib/dynbuf.c | 13 ++++++++-----
lib/dynbuf.h | 16 ++++++++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/lib/dynbuf.c b/lib/dynbuf.c
index 265a769e8..5e15040bb 100644
--- a/lib/dynbuf.c
+++ b/lib/dynbuf.c
@@ -21,12 +21,11 @@
***************************************************************************/
#include "curl_setup.h"
-#include "strdup.h"
#include "dynbuf.h"
-
-/* The last 3 #include files should be in this order */
#include "curl_printf.h"
+#ifdef BUILDING_LIBCURL
#include "curl_memory.h"
+#endif
#include "memdebug.h"
#define MIN_FIRST_ALLOC 32
@@ -94,11 +93,15 @@ static CURLcode dyn_nappend(struct dynbuf *s,
}
if(a != s->allc) {
- s->bufr = Curl_saferealloc(s->bufr, a);
- if(!s->bufr) {
+ /* this logic is not using Curl_saferealloc() to make the tool not have to
+ include that as well when it uses this code */
+ void *p = realloc(s->bufr, a);
+ if(!p) {
+ Curl_safefree(s->bufr);
s->leng = s->allc = 0;
return CURLE_OUT_OF_MEMORY;
}
+ s->bufr = p;
s->allc = a;
}
diff --git a/lib/dynbuf.h b/lib/dynbuf.h
index ecc995755..1360dd432 100644
--- a/lib/dynbuf.h
+++ b/lib/dynbuf.h
@@ -22,6 +22,22 @@
*
***************************************************************************/
+#ifndef BUILDING_LIBCURL
+/* this renames the functions so that the tool code can use the same code
+ without getting symbol collisions */
+#define Curl_dyn_init(a,b) curlx_dyn_init(a,b)
+#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_free(a) curlx_dyn_free(a)
+#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
+#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
+#define Curl_dyn_len(a) curlx_dyn_len(a)
+#define Curl_dyn_reset(a) curlx_dyn_reset(a)
+#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b)
+#define curlx_dynbuf dynbuf /* for the struct name */
+#endif
+
struct dynbuf {
char *bufr; /* point to a null-terminated allocated buffer */
size_t leng; /* number of bytes *EXCLUDING* the zero terminator */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 119/411: base64: enable in build with SMTP, (continued)
- [gnurl] 119/411: base64: enable in build with SMTP, gnunet, 2021/01/12
- [gnurl] 122/411: http: consolidate nghttp2_session_mem_recv() call paths, gnunet, 2021/01/12
- [gnurl] 115/411: lib: fix -Wassign-enum warnings, gnunet, 2021/01/12
- [gnurl] 118/411: curl_mime_headers.3: fix the example's use of curl_slist_append, gnunet, 2021/01/12
- [gnurl] 113/411: url: use blank credentials when using proxy w/o username and password, gnunet, 2021/01/12
- [gnurl] 136/411: ftp: a 550 response to SIZE returns CURLE_REMOTE_FILE_NOT_FOUND, gnunet, 2021/01/12
- [gnurl] 134/411: curl: make glob_match_url use dynbuf, gnunet, 2021/01/12
- [gnurl] 105/411: CI/azure: add test number to title for display in analytics, gnunet, 2021/01/12
- [gnurl] 87/411: http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set, gnunet, 2021/01/12
- [gnurl] 102/411: tests: remove pipelining tests, gnunet, 2021/01/12
- [gnurl] 126/411: dynbuf: provide curlx_ names for reuse by the curl tool,
gnunet <=
- [gnurl] 121/411: HISTORY: mention alt-svc added in 2019, gnunet, 2021/01/12
- [gnurl] 96/411: easygetopt: pass a valid enum to avoid compiler warning, gnunet, 2021/01/12
- [gnurl] 94/411: tool: update --help with categories, gnunet, 2021/01/12
- [gnurl] 104/411: altsvc: clone setting in curl_easy_duphandle, gnunet, 2021/01/12
- [gnurl] 112/411: travis: add a build using libressl (from git master), gnunet, 2021/01/12
- [gnurl] 131/411: imap: set cselect_bits to CURL_CSELECT_IN initially, gnunet, 2021/01/12
- [gnurl] 128/411: runtests: allow creating files without newlines, gnunet, 2021/01/12
- [gnurl] 147/411: TODO: add PR reference for native IDN support on macOS, gnunet, 2021/01/12
- [gnurl] 155/411: ftp: get rid of the PPSENDF macro, gnunet, 2021/01/12
- [gnurl] 167/411: parsedate: tune the date to epoch conversion, gnunet, 2021/01/12