diff options
| author | 2020-02-26 18:47:24 +0000 | |
|---|---|---|
| committer | 2020-02-26 18:47:24 +0000 | |
| commit | 637d8eb612a8d36569ff681fc1140eb404d28207 (patch) | |
| tree | 0ff7f4ec95835de121ef441ef94d709b65b2c42a /usr.bin/dig/lib/isc/buffer.c | |
| parent | Always printing unknown types as TYPE%u and not sometimes as %u (diff) | |
| download | wireguard-openbsd-637d8eb612a8d36569ff681fc1140eb404d28207.tar.xz wireguard-openbsd-637d8eb612a8d36569ff681fc1140eb404d28207.zip | |
In preparation of compiling lib/dns/rdata/ files individually we need
global visibility of mem_tobuffer.
Rename it to isc_mem_tobuffer, put it into buffer.c and delete
duplicate implementations.
Diffstat (limited to 'usr.bin/dig/lib/isc/buffer.c')
| -rw-r--r-- | usr.bin/dig/lib/isc/buffer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/dig/lib/isc/buffer.c b/usr.bin/dig/lib/isc/buffer.c index 735dc0a8c85..9dce1033ec8 100644 --- a/usr.bin/dig/lib/isc/buffer.c +++ b/usr.bin/dig/lib/isc/buffer.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: buffer.c,v 1.6 2020/02/25 05:00:43 jsg Exp $ */ +/* $Id: buffer.c,v 1.7 2020/02/26 18:47:25 florian Exp $ */ /*! \file */ @@ -352,3 +352,15 @@ isc_buffer_free(isc_buffer_t **dynbuffer) { free(dbuf); } + +isc_result_t +isc_mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) { + isc_region_t tr; + + isc_buffer_availableregion(target, &tr); + if (length > tr.length) + return (ISC_R_NOSPACE); + memmove(tr.base, base, length); + isc_buffer_add(target, length); + return (ISC_R_SUCCESS); +} |
