Commit 4bf32aa5 authored by Mark Andrews's avatar Mark Andrews

4654. [cleanup] Don't use C++ keywords delete, new and namespace.

                        [RT #45538]
parent 0297ebcc
4654. [cleanup] Don't use C++ keywords delete, new and namespace.
[RT #45538]
4653. [bug] Reorder includes to move @DST_OPENSSL_INC@ and
@ISC_OPENSSL_INC@ after shipped include directories.
[RT #45581]
......
......@@ -2321,10 +2321,10 @@ setup_lookup(dig_lookup_t *lookup) {
check_result(result, "dns_message_gettempname");
dns_name_init(lookup->name, NULL);
isc_buffer_init(&lookup->namebuf, lookup->namespace,
sizeof(lookup->namespace));
isc_buffer_init(&lookup->onamebuf, lookup->onamespace,
sizeof(lookup->onamespace));
isc_buffer_init(&lookup->namebuf, lookup->name_space,
sizeof(lookup->name_space));
isc_buffer_init(&lookup->onamebuf, lookup->oname_space,
sizeof(lookup->oname_space));
#ifdef WITH_IDN
/*
......
......@@ -164,8 +164,8 @@ isc_boolean_t sigchase;
dns_rdataclass_t rdclass;
isc_boolean_t rdtypeset;
isc_boolean_t rdclassset;
char namespace[BUFSIZE];
char onamespace[BUFSIZE];
char name_space[BUFSIZE];
char oname_space[BUFSIZE];
isc_buffer_t namebuf;
isc_buffer_t onamebuf;
isc_buffer_t renderbuf;
......
......@@ -155,7 +155,7 @@ main(int argc, char **argv) {
char *label = NULL;
dns_ttl_t ttl = 0;
isc_stdtime_t publish = 0, activate = 0, revoke = 0;
isc_stdtime_t inactive = 0, delete = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
......@@ -317,8 +317,8 @@ main(int argc, char **argv) {
if (setdel || unsetdel)
fatal("-D specified more than once");
delete = strtotime(isc_commandline_argument,
now, now, &setdel);
deltime = strtotime(isc_commandline_argument,
now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
......@@ -662,7 +662,7 @@ main(int argc, char **argv) {
dst_key_settime(key, DST_TIME_INACTIVE, inactive);
if (setdel)
dst_key_settime(key, DST_TIME_DELETE, delete);
dst_key_settime(key, DST_TIME_DELETE, deltime);
if (setsyncadd)
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncadd);
if (setsyncdel)
......
......@@ -239,7 +239,7 @@ main(int argc, char **argv) {
dns_ttl_t ttl = 0;
isc_boolean_t use_default = ISC_FALSE, use_nsec3 = ISC_FALSE;
isc_stdtime_t publish = 0, activate = 0, revokekey = 0;
isc_stdtime_t inactive = 0, delete = 0;
isc_stdtime_t inactive = 0, deltime = 0;
isc_stdtime_t now;
int prepub = -1;
isc_boolean_t setpub = ISC_FALSE, setact = ISC_FALSE;
......@@ -467,8 +467,8 @@ main(int argc, char **argv) {
if (setdel || unsetdel)
fatal("-D specified more than once");
delete = strtotime(isc_commandline_argument,
now, now, &setdel);
deltime = strtotime(isc_commandline_argument,
now, now, &setdel);
unsetdel = !setdel;
break;
case 'S':
......@@ -1007,13 +1007,13 @@ main(int argc, char **argv) {
inactive);
if (setdel) {
if (setinact && delete < inactive)
if (setinact && deltime < inactive)
fprintf(stderr, "%s: warning: Key is "
"scheduled to be deleted "
"before it is scheduled to be "
"made inactive.\n",
program);
dst_key_settime(key, DST_TIME_DELETE, delete);
dst_key_settime(key, DST_TIME_DELETE, deltime);
}
if (setsyncadd)
......
......@@ -662,20 +662,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
/* Grow lists? */
if (listcount == l) {
void * new;
void * tmp;
isc_uint32_t newlen = listcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*lists);
oldsize = listcount * sizeof(*lists);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (listcount != 0) {
memmove(new, lists, oldsize);
memmove(tmp, lists, oldsize);
isc_mem_put(mctx, lists, oldsize);
}
lists = new;
lists = tmp;
listcount = newlen;
}
/* Seen? */
......@@ -697,20 +697,20 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
lists[l++].name = listname;
/* Grow stack? */
if (stackcount == pushed) {
void * new;
void * tmp;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (stackcount != 0) {
memmove(new, stack, oldsize);
memmove(tmp, stack, oldsize);
isc_mem_put(mctx, stack, oldsize);
}
stack = new;
stack = tmp;
stackcount = newlen;
}
/*
......@@ -725,44 +725,44 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
}
if (i == addrcount) {
void * new;
void * tmp;
isc_uint32_t newlen = addrcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (addrcount != 0) {
memmove(new, addrs, oldsize);
memmove(tmp, addrs, oldsize);
isc_mem_put(mctx, addrs, oldsize);
}
addrs = new;
addrs = tmp;
addrcount = newlen;
newsize = newlen * sizeof(isc_dscp_t);
oldsize = dscpcount * sizeof(isc_dscp_t);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (dscpcount != 0) {
memmove(new, dscps, oldsize);
memmove(tmp, dscps, oldsize);
isc_mem_put(mctx, dscps, oldsize);
}
dscps = new;
dscps = tmp;
dscpcount = newlen;
newsize = newlen * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
if (keycount != 0) {
memmove(new, keys, oldsize);
memmove(tmp, keys, oldsize);
isc_mem_put(mctx, keys, oldsize);
}
keys = new;
keys = tmp;
keycount = newlen;
}
......@@ -802,46 +802,46 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
goto resume;
}
if (i < addrcount) {
void * new;
void * tmp;
size_t newsize, oldsize;
newsize = i * sizeof(isc_sockaddr_t);
oldsize = addrcount * sizeof(isc_sockaddr_t);
if (i != 0) {
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
memmove(new, addrs, newsize);
memmove(tmp, addrs, newsize);
} else
new = NULL;
tmp = NULL;
isc_mem_put(mctx, addrs, oldsize);
addrs = new;
addrs = tmp;
addrcount = i;
newsize = i * sizeof(isc_dscp_t);
oldsize = dscpcount * sizeof(isc_dscp_t);
if (i != 0) {
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
memmove(new, dscps, newsize);
memmove(tmp, dscps, newsize);
} else
new = NULL;
tmp = NULL;
isc_mem_put(mctx, dscps, oldsize);
dscps = new;
dscps = tmp;
dscpcount = i;
newsize = i * sizeof(dns_name_t *);
oldsize = keycount * sizeof(dns_name_t *);
if (i != 0) {
new = isc_mem_get(mctx, newsize);
if (new == NULL)
tmp = isc_mem_get(mctx, newsize);
if (tmp == NULL)
goto cleanup;
memmove(new, keys, newsize);
memmove(tmp, keys, newsize);
} else
new = NULL;
tmp = NULL;
isc_mem_put(mctx, keys, oldsize);
keys = new;
keys = tmp;
keycount = i;
}
......
......@@ -80,7 +80,7 @@ int
main(int argc, char **argv) {
isc_result_t result;
char *origin, *file1, *file2, *journal;
dns_db_t *old = NULL, *new = NULL;
dns_db_t *olddb = NULL, *newdb = NULL;
isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL;
......@@ -121,28 +121,28 @@ main(int argc, char **argv) {
dns_result_register();
result = loadzone(&old, origin, file1);
result = loadzone(&olddb, origin, file1);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't load %s: ", file1);
goto cleanup;
}
result = loadzone(&new, origin, file2);
result = loadzone(&newdb, origin, file2);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "Couldn't load %s: ", file2);
goto cleanup;
}
result = dns_db_diff(mctx, new, NULL, old, NULL, journal);
result = dns_db_diff(mctx, newdb, NULL, olddb, NULL, journal);
cleanup:
if (result != ISC_R_SUCCESS)
fprintf(stderr, "%s\n", isc_result_totext(result));
if (new != NULL)
dns_db_detach(&new);
if (old != NULL)
dns_db_detach(&old);
if (newdb != NULL)
dns_db_detach(&newdb);
if (olddb != NULL)
dns_db_detach(&olddb);
if (lctx != NULL)
isc_log_destroy(&lctx);
......
......@@ -1609,23 +1609,23 @@ validate_masters(const cfg_obj_t *obj, const cfg_obj_t *config,
}
/* Grow stack? */
if (stackcount == pushed) {
void * new;
void * newstack;
isc_uint32_t newlen = stackcount + 16;
size_t newsize, oldsize;
newsize = newlen * sizeof(*stack);
oldsize = stackcount * sizeof(*stack);
new = isc_mem_get(mctx, newsize);
if (new == NULL)
newstack = isc_mem_get(mctx, newsize);
if (newstack == NULL)
goto cleanup;
if (stackcount != 0) {
void *ptr;
DE_CONST(stack, ptr);
memmove(new, stack, oldsize);
memmove(newstack, stack, oldsize);
isc_mem_put(mctx, ptr, oldsize);
}
stack = new;
stack = newstack;
stackcount = newlen;
}
stack[pushed++] = cfg_list_next(element);
......
......@@ -619,7 +619,7 @@ dns_client_destroy(dns_client_t **clientp) {
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
const dns_name_t *namespace, isc_sockaddrlist_t *addrs)
const dns_name_t *name_space, isc_sockaddrlist_t *addrs)
{
isc_result_t result;
dns_view_t *view = NULL;
......@@ -627,8 +627,8 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
REQUIRE(DNS_CLIENT_VALID(client));
REQUIRE(addrs != NULL);
if (namespace == NULL)
namespace = dns_rootname;
if (name_space == NULL)
name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
......@@ -639,7 +639,7 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
}
UNLOCK(&client->lock);
result = dns_fwdtable_add(view->fwdtable, namespace, addrs,
result = dns_fwdtable_add(view->fwdtable, name_space, addrs,
dns_fwdpolicy_only);
dns_view_detach(&view);
......@@ -649,15 +649,15 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
const dns_name_t *namespace)
const dns_name_t *name_space)
{
isc_result_t result;
dns_view_t *view = NULL;
REQUIRE(DNS_CLIENT_VALID(client));
if (namespace == NULL)
namespace = dns_rootname;
if (name_space == NULL)
name_space = dns_rootname;
LOCK(&client->lock);
result = dns_viewlist_find(&client->viewlist, DNS_CLIENTVIEW_NAME,
......@@ -668,7 +668,7 @@ dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
}
UNLOCK(&client->lock);
result = dns_fwdtable_delete(view->fwdtable, namespace);
result = dns_fwdtable_delete(view->fwdtable, name_space);
dns_view_detach(&view);
......
......@@ -49,9 +49,9 @@ isc_result_t
dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
unsigned int prefixlen, const isc_netaddr_t *suffix,
dns_acl_t *clients, dns_acl_t *mapped, dns_acl_t *excluded,
unsigned int flags, dns_dns64_t **dns64)
unsigned int flags, dns_dns64_t **dns64p)
{
dns_dns64_t *new;
dns_dns64_t *dns64;
unsigned int nbytes = 16;
REQUIRE(prefix != NULL && prefix->family == AF_INET6);
......@@ -59,7 +59,7 @@ dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
REQUIRE(prefixlen == 32 || prefixlen == 40 || prefixlen == 48 ||
prefixlen == 56 || prefixlen == 64 || prefixlen == 96);
REQUIRE(isc_netaddr_prefixok(prefix, prefixlen) == ISC_R_SUCCESS);
REQUIRE(dns64 != NULL && *dns64 == NULL);
REQUIRE(dns64p != NULL && *dns64p == NULL);
if (suffix != NULL) {
static const unsigned char zeros[16];
......@@ -71,29 +71,29 @@ dns_dns64_create(isc_mem_t *mctx, const isc_netaddr_t *prefix,
REQUIRE(memcmp(suffix->type.in6.s6_addr, zeros, nbytes) == 0);
}
new = isc_mem_get(mctx, sizeof(dns_dns64_t));
if (new == NULL)
dns64 = isc_mem_get(mctx, sizeof(dns_dns64_t));
if (dns64 == NULL)
return (ISC_R_NOMEMORY);
memset(new->bits, 0, sizeof(new->bits));
memmove(new->bits, prefix->type.in6.s6_addr, prefixlen / 8);
memset(dns64->bits, 0, sizeof(dns64->bits));
memmove(dns64->bits, prefix->type.in6.s6_addr, prefixlen / 8);
if (suffix != NULL)
memmove(new->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
memmove(dns64->bits + nbytes, suffix->type.in6.s6_addr + nbytes,
16 - nbytes);
new->clients = NULL;
dns64->clients = NULL;
if (clients != NULL)
dns_acl_attach(clients, &new->clients);
new->mapped = NULL;
dns_acl_attach(clients, &dns64->clients);
dns64->mapped = NULL;
if (mapped != NULL)
dns_acl_attach(mapped, &new->mapped);
new->excluded = NULL;
dns_acl_attach(mapped, &dns64->mapped);
dns64->excluded = NULL;
if (excluded != NULL)
dns_acl_attach(excluded, &new->excluded);
new->prefixlen = prefixlen;
new->flags = flags;
ISC_LINK_INIT(new, link);
new->mctx = NULL;
isc_mem_attach(mctx, &new->mctx);
*dns64 = new;
dns_acl_attach(excluded, &dns64->excluded);
dns64->prefixlen = prefixlen;
dns64->flags = flags;
ISC_LINK_INIT(dns64, link);
dns64->mctx = NULL;
isc_mem_attach(mctx, &dns64->mctx);
*dns64p = dns64;
return (ISC_R_SUCCESS);
}
......
......@@ -604,7 +604,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
isc_boolean_t
dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
isc_result_t result;
isc_stdtime_t publish, active, revoke, inactive, delete;
isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
......@@ -637,11 +637,11 @@ dns_dnssec_keyactive(dst_key_t *key, isc_stdtime_t now) {
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
result = dst_key_gettime(key, DST_TIME_DELETE, &delete);
result = dst_key_gettime(key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
if ((inactset && inactive <= now) || (delset && delete <= now))
if ((inactset && inactive <= now) || (delset && deltime <= now))
return (ISC_FALSE);
if (revset && revoke <= now && pubset && publish <= now)
......@@ -1309,7 +1309,7 @@ dns_dnsseckey_destroy(isc_mem_t *mctx, dns_dnsseckey_t **dkp) {
static void
get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
isc_result_t result;
isc_stdtime_t publish, active, revoke, inactive, delete;
isc_stdtime_t publish, active, revoke, inactive, deltime;
isc_boolean_t pubset = ISC_FALSE, actset = ISC_FALSE;
isc_boolean_t revset = ISC_FALSE, inactset = ISC_FALSE;
isc_boolean_t delset = ISC_FALSE;
......@@ -1332,7 +1332,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
if (result == ISC_R_SUCCESS)
inactset = ISC_TRUE;
result = dst_key_gettime(key->key, DST_TIME_DELETE, &delete);
result = dst_key_gettime(key->key, DST_TIME_DELETE, &deltime);
if (result == ISC_R_SUCCESS)
delset = ISC_TRUE;
......@@ -1392,7 +1392,7 @@ get_hints(dns_dnsseckey_t *key, isc_stdtime_t now) {
/*
* Metadata says delete, so don't publish this key or sign with it.
*/
if (delset && delete <= now) {
if (delset && deltime <= now) {
key->hint_publish = ISC_FALSE;
key->hint_sign = ISC_FALSE;
key->hint_remove = ISC_TRUE;
......@@ -1839,8 +1839,8 @@ publish(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
}
static isc_result_t
delete(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
dns_ttl_t ttl, isc_mem_t *mctx)
delrdata(dns_rdata_t *rdata, dns_diff_t *diff, dns_name_t *origin,
dns_ttl_t ttl, isc_mem_t *mctx)
{
isc_result_t result;
dns_difftuple_t *tuple = NULL;
......@@ -2002,18 +2002,18 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
if (dns_rdataset_isassociated(cds) &&
syncdelete(key->key, now)) {
if (exists(cds, &cdsrdata1))
RETERR(delete(&cdsrdata1, diff, origin,
cds->ttl, mctx));
RETERR(delrdata(&cdsrdata1, diff, origin,
cds->ttl, mctx));
if (exists(cds, &cdsrdata2))
RETERR(delete(&cdsrdata2, diff, origin,
cds->ttl, mctx));
RETERR(delrdata(&cdsrdata2, diff, origin,
cds->ttl, mctx));
}
if (dns_rdataset_isassociated(cdnskey) &&
syncdelete(key->key, now)) {
if (exists(cdnskey, &cdnskeyrdata))
RETERR(delete(&cdnskeyrdata, diff, origin,
cdnskey->ttl, mctx));
RETERR(delrdata(&cdnskeyrdata, diff, origin,
cdnskey->ttl, mctx));
}
}
......@@ -2043,17 +2043,17 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
DNS_DSDIGEST_SHA256, dsbuf2,
&cdsrdata2));
if (exists(cds, &cdsrdata1))
RETERR(delete(&cdsrdata1, diff, origin,
cds->ttl, mctx));
RETERR(delrdata(&cdsrdata1, diff, origin,
cds->ttl, mctx));
if (exists(cds, &cdsrdata2))
RETERR(delete(&cdsrdata2, diff, origin,
cds->ttl, mctx));
RETERR(delrdata(&cdsrdata2, diff, origin,
cds->ttl, mctx));
}
if (dns_rdataset_isassociated(cdnskey)) {
if (exists(cdnskey, &cdnskeyrdata))
RETERR(delete(&cdnskeyrdata, diff, origin,
cdnskey->ttl, mctx));
RETERR(delrdata(&cdnskeyrdata, diff, origin,
cdnskey->ttl, mctx));
}
}
......
......@@ -222,22 +222,22 @@ dns_client_destroy(dns_client_t **clientp);
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
const dns_name_t *namespace, isc_sockaddrlist_t *addrs);
const dns_name_t *name_space, isc_sockaddrlist_t *addrs);
/*%<
* Specify a list of addresses of recursive name servers that the client will
* use for name resolution. A view for the 'rdclass' class must be created
* beforehand. If 'namespace' is non NULL, the specified server will be used
* if and only if the query name is a subdomain of 'namespace'. When servers
* for multiple 'namespace's are provided, and a query name is covered by
* more than one 'namespace', the servers for the best (longest) matching
* namespace will be used. If 'namespace' is NULL, it works as if
* beforehand. If 'name_space' is non NULL, the specified server will be used
* if and only if the query name is a subdomain of 'name_space'. When servers
* for multiple 'name_space's are provided, and a query name is covered by
* more than one 'name_space', the servers for the best (longest) matching
* name_space will be used. If 'name_space' is NULL, it works as if
* dns_rootname (.) were specified.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*\li 'name_space' is NULL or a valid name.
*
*\li 'addrs' != NULL.
*
......@@ -250,17 +250,17 @@ dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
const dns_name_t *namespace);
const dns_name_t *name_space);
/*%<
* Remove configured recursive name servers for the 'rdclass' and 'namespace'
* Remove configured recursive name servers for the 'rdclass' and 'name_space'
* from the client. See the description of dns_client_setservers() for
* the requirements about 'rdclass' and 'namespace'.
* the requirements about 'rdclass' and 'name_space'.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*\li 'name_space' is NULL or a valid name.
*
* Returns:
*
......
......@@ -2089,8 +2089,8 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, isc_uint32_t serial,