mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
convert to isc_mem_strdup
This commit is contained in:
@@ -28,19 +28,6 @@
|
|||||||
isc_mem_t *mctx;
|
isc_mem_t *mctx;
|
||||||
isc_symtab_t *st;
|
isc_symtab_t *st;
|
||||||
|
|
||||||
static char *
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
undefine_action(char *key, unsigned int type, isc_symvalue_t value) {
|
undefine_action(char *key, unsigned int type, isc_symvalue_t value) {
|
||||||
INSIST(type == 1);
|
INSIST(type == 1);
|
||||||
@@ -104,8 +91,8 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*cp++ = '\0';
|
*cp++ = '\0';
|
||||||
key = mem_strdup(mctx, key);
|
key = isc_mem_strdup(mctx, key);
|
||||||
value.as_pointer = mem_strdup(mctx, cp);
|
value.as_pointer = isc_mem_strdup(mctx, cp);
|
||||||
result = isc_symtab_define(st, key, 1, value,
|
result = isc_symtab_define(st, key, 1, value,
|
||||||
exists_policy);
|
exists_policy);
|
||||||
if (trace || result != ISC_R_SUCCESS) {
|
if (trace || result != ISC_R_SUCCESS) {
|
||||||
|
Reference in New Issue
Block a user