diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-02 17:04:08 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-04 10:40:39 +0200 |
commit | ed35d6590e72c23c568af1e3b8ac6e4e2d883888 (patch) | |
tree | 57555732f4f452bf84c3c7296581485be064a853 /lib/doh.h | |
parent | 00c2e8da9a9555ce6171e3f7ddc5e43fc6f9bb4b (diff) | |
download | curl-ed35d6590e72c23c568af1e3b8ac6e4e2d883888.tar.gz |
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 'lib/doh.h')
-rw-r--r-- | lib/doh.h | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -70,12 +70,6 @@ typedef enum { #define DOH_MAX_ADDR 24 #define DOH_MAX_CNAME 4 -struct cnamestore { - size_t len; /* length of cname */ - char *alloc; /* allocated pointer */ - size_t allocsize; /* allocated size */ -}; - struct dohaddr { int type; union { @@ -85,11 +79,11 @@ struct dohaddr { }; struct dohentry { - unsigned int ttl; - int numaddr; + struct dynbuf cname[DOH_MAX_CNAME]; struct dohaddr addr[DOH_MAX_ADDR]; + int numaddr; + unsigned int ttl; int numcname; - struct cnamestore cname[DOH_MAX_CNAME]; }; @@ -103,6 +97,7 @@ DOHcode doh_decode(const unsigned char *doh, size_t dohlen, DNStype dnstype, struct dohentry *d); +void de_init(struct dohentry *d); void de_cleanup(struct dohentry *d); #endif |