aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-05-02 17:04:08 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-04 10:40:39 +0200
commited35d6590e72c23c568af1e3b8ac6e4e2d883888 (patch)
tree57555732f4f452bf84c3c7296581485be064a853 /tests
parent00c2e8da9a9555ce6171e3f7ddc5e43fc6f9bb4b (diff)
dynbuf: introduce internal generic dynamic buffer functions
A common set of functions instead of many separate implementations for creating buffers that can grow when appending data to them. Existing functionality has been ported over. In my early basic testing, the total number of allocations seem at roughly the same amount as before, possibly a few less. See docs/DYNBUF.md for a description of the API. Closes #5300
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test5581
-rw-r--r--tests/libtest/Makefile.inc2
-rw-r--r--tests/server/Makefile.inc8
-rw-r--r--tests/unit/unit1650.c5
4 files changed, 10 insertions, 6 deletions
diff --git a/tests/data/test558 b/tests/data/test558
index dccb8080a..946979677 100644
--- a/tests/data/test558
+++ b/tests/data/test558
@@ -38,7 +38,6 @@ nothing
<file name="log/memdump">
MEM lib558.c: malloc()
MEM lib558.c: free()
-MEM escape.c: malloc()
MEM strdup.c: realloc()
MEM strdup.c: realloc()
MEM escape.c: free()
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index 1651308b1..5d1c773e5 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -59,7 +59,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib2033
chkdecimalpoint_SOURCES = chkdecimalpoint.c ../../lib/mprintf.c \
- ../../lib/curl_ctype.c
+ ../../lib/curl_ctype.c ../../lib/dynbuf.c ../../lib/strdup.c
chkdecimalpoint_LDADD =
chkdecimalpoint_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB \
-DCURLX_NO_MEMORY_CALLBACKS
diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc
index fb13d79cb..5dfe8076b 100644
--- a/tests/server/Makefile.inc
+++ b/tests/server/Makefile.inc
@@ -28,14 +28,18 @@ CURLX_SRCS = \
../../lib/nonblock.c \
../../lib/strtoofft.c \
../../lib/warnless.c \
- ../../lib/curl_ctype.c
+ ../../lib/curl_ctype.c \
+ ../../lib/dynbuf.c \
+ ../../lib/strdup.c
CURLX_HDRS = \
../../lib/curlx.h \
../../lib/nonblock.h \
../../lib/strtoofft.h \
../../lib/warnless.h \
- ../../lib/curl_ctype.h
+ ../../lib/curl_ctype.h \
+ ../../lib/dynbuf.h \
+ ../../lib/strdup.h
USEFUL = \
getpart.c \
diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c
index e656c073a..b2fc89efa 100644
--- a/tests/unit/unit1650.c
+++ b/tests/unit/unit1650.c
@@ -22,6 +22,7 @@
#include "curlcheck.h"
#include "doh.h"
+#include "dynbuf.h"
static CURLcode unit_setup(void)
{
@@ -184,7 +185,7 @@ UNITTEST_START
char *ptr;
size_t len;
int u;
- memset(&d, 0, sizeof(d));
+ de_init(&d);
rc = doh_decode((const unsigned char *)resp[i].packet, resp[i].size,
resp[i].type, &d);
if(rc != resp[i].rc) {
@@ -222,7 +223,7 @@ UNITTEST_START
}
for(u = 0; u < d.numcname; u++) {
size_t o;
- msnprintf(ptr, len, "%s ", d.cname[u].alloc);
+ msnprintf(ptr, len, "%s ", Curl_dyn_ptr(&d.cname[u]));
o = strlen(ptr);
len -= o;
ptr += o;