mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Add name_duporclone() and mem_maybedup().
This commit is contained in:
parent
09f22ac5b0
commit
2002be4f65
@ -15,7 +15,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rdata.c,v 1.81 2000/04/29 01:48:11 gson Exp $ */
|
||||
/* $Id: rdata.c,v 1.82 2000/05/02 05:19:47 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -110,6 +110,28 @@ static isc_result_t rdata_totext(dns_rdata_t *rdata,
|
||||
dns_rdata_textctx_t *tctx,
|
||||
isc_buffer_t *target);
|
||||
|
||||
static inline isc_result_t
|
||||
name_duporclone(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) {
|
||||
|
||||
if (mctx != NULL)
|
||||
return (dns_name_dup(source, mctx, target));
|
||||
dns_name_clone(source, target);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
mem_maybedup(isc_mem_t *mctx, void *source, size_t length) {
|
||||
void *new;
|
||||
|
||||
if (mctx == NULL)
|
||||
return (source);
|
||||
new = isc_mem_allocate(mctx, length);
|
||||
if (new != NULL)
|
||||
memcpy(new, source, length);
|
||||
|
||||
return (new);
|
||||
}
|
||||
|
||||
static const char hexdigits[] = "0123456789abcdef";
|
||||
static const char decdigits[] = "0123456789";
|
||||
static const char octdigits[] = "01234567";
|
||||
|
Loading…
x
Reference in New Issue
Block a user