2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

add isc_mem_strdup

This commit is contained in:
Bob Halley 1998-12-30 20:17:02 +00:00
parent 566f721b3a
commit dad8d67ed0
2 changed files with 15 additions and 0 deletions

View File

@ -46,6 +46,7 @@ void isc_mem_stats(isc_mem_t *, FILE *);
isc_boolean_t isc_mem_valid(isc_mem_t *, void *); isc_boolean_t isc_mem_valid(isc_mem_t *, void *);
void * isc_mem_allocate(isc_mem_t *, size_t); void * isc_mem_allocate(isc_mem_t *, size_t);
void isc_mem_free(isc_mem_t *, void *); void isc_mem_free(isc_mem_t *, void *);
char * isc_mem_strdup(isc_mem_t *, const char *);
#ifdef ISC_MEMCLUSTER_LEGACY #ifdef ISC_MEMCLUSTER_LEGACY

View File

@ -438,6 +438,20 @@ isc_mem_free(isc_mem_t *ctx, void *ptr) {
isc_mem_put(ctx, si, si->size); 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 #ifdef ISC_MEMCLUSTER_LEGACY
/* /*