Commit dad8d67e authored by Bob Halley's avatar Bob Halley
Browse files

add isc_mem_strdup

parent 566f721b
......@@ -46,6 +46,7 @@ void isc_mem_stats(isc_mem_t *, FILE *);
isc_boolean_t isc_mem_valid(isc_mem_t *, void *);
void * isc_mem_allocate(isc_mem_t *, size_t);
void isc_mem_free(isc_mem_t *, void *);
char * isc_mem_strdup(isc_mem_t *, const char *);
#ifdef ISC_MEMCLUSTER_LEGACY
......
......@@ -438,6 +438,20 @@ isc_mem_free(isc_mem_t *ctx, void *ptr) {
isc_mem_put(ctx, si, si->size);
}
char *
isc_mem_strdup(isc_mem_t *mctx, const char *s) {
size_t len;
char *ns;
len = strlen(s);
ns = isc_mem_allocate(mctx, len + 1);
if (ns == NULL)
return (NULL);
strncpy(ns, s, len + 1);
return (ns);
}
#ifdef ISC_MEMCLUSTER_LEGACY
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment