Commit ecfa0050 authored by Mark Andrews's avatar Mark Andrews
Browse files

4403. [bug] Rename variables and arguments that shadow: basename,

			clone and gai_error.
parent d75bbd0d
4403. [bug] Rename variables and arguments that shadow: basename,
clone and gai_error.
4402. [bug] protoc-c is now a hard requirement for --enable-dnstap.
4401. [misc] Change LICENSE to MPL 2.0.
......
......@@ -773,7 +773,7 @@ setup_dnsseckeys(dns_client_t *client) {
static isc_result_t
addserver(dns_client_t *client) {
struct addrinfo hints, *res, *cur;
int gai_error;
int gaierror;
struct in_addr in4;
struct in6_addr in6;
isc_sockaddr_t *sa;
......@@ -812,11 +812,11 @@ addserver(dns_client_t *client) {
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
gai_error = getaddrinfo(server, port, &hints, &res);
if (gai_error != 0) {
gaierror = getaddrinfo(server, port, &hints, &res);
if (gaierror != 0) {
delv_log(ISC_LOG_ERROR,
"getaddrinfo failed: %s",
gai_strerror(gai_error));
gai_strerror(gaierror));
return (ISC_R_FAILURE);
}
......
......@@ -2841,7 +2841,7 @@ dns_adb_detach(dns_adb_t **adbx) {
void
dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) {
isc_task_t *clone;
isc_task_t *tclone;
isc_event_t *event;
isc_boolean_t zeroirefcnt = ISC_FALSE;
......@@ -2868,9 +2868,9 @@ dns_adb_whenshutdown(dns_adb_t *adb, isc_task_t *task, isc_event_t **eventp) {
event->ev_sender = adb;
isc_task_send(task, &event);
} else {
clone = NULL;
isc_task_attach(task, &clone);
event->ev_sender = clone;
tclone = NULL;
isc_task_attach(task, &tclone);
event->ev_sender = tclone;
ISC_LIST_APPEND(adb->whenshutdown, event, ev_link);
}
......
......@@ -1321,7 +1321,7 @@ dns_client_startresolve(dns_client_t *client, dns_name_t *name,
dns_view_t *view = NULL;
dns_clientresevent_t *event = NULL;
resctx_t *rctx = NULL;
isc_task_t *clone = NULL;
isc_task_t *tclone = NULL;
isc_mem_t *mctx;
isc_result_t result;
dns_rdataset_t *rdataset, *sigrdataset;
......@@ -1348,10 +1348,10 @@ dns_client_startresolve(dns_client_t *client, dns_name_t *name,
/*
* Prepare some intermediate resources
*/
clone = NULL;
isc_task_attach(task, &clone);
tclone = NULL;
isc_task_attach(task, &tclone);
event = (dns_clientresevent_t *)
isc_event_allocate(mctx, clone, DNS_EVENT_CLIENTRESDONE,
isc_event_allocate(mctx, tclone, DNS_EVENT_CLIENTRESDONE,
action, arg, sizeof(*event));
if (event == NULL) {
result = ISC_R_NOMEMORY;
......@@ -1427,7 +1427,7 @@ dns_client_startresolve(dns_client_t *client, dns_name_t *name,
}
if (event != NULL)
isc_event_free(ISC_EVENT_PTR(&event));
isc_task_detach(&clone);
isc_task_detach(&tclone);
dns_view_detach(&view);
return (result);
......@@ -1726,7 +1726,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
{
isc_result_t result;
dns_view_t *view = NULL;
isc_task_t *clone = NULL;
isc_task_t *tclone = NULL;
dns_clientreqevent_t *event = NULL;
reqctx_t *ctx = NULL;
dns_tsectype_t tsectype = dns_tsectype_none;
......@@ -1754,10 +1754,10 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
if ((options & DNS_CLIENTREQOPT_TCP) != 0)
reqoptions |= DNS_REQUESTOPT_TCP;
clone = NULL;
isc_task_attach(task, &clone);
tclone = NULL;
isc_task_attach(task, &tclone);
event = (dns_clientreqevent_t *)
isc_event_allocate(client->mctx, clone,
isc_event_allocate(client->mctx, tclone,
DNS_EVENT_CLIENTREQDONE,
action, arg, sizeof(*event));
if (event == NULL) {
......@@ -1816,7 +1816,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
}
if (event != NULL)
isc_event_free(ISC_EVENT_PTR(&event));
isc_task_detach(&clone);
isc_task_detach(&tclone);
dns_view_detach(&view);
return (result);
......@@ -2771,7 +2771,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
isc_result_t result;
dns_name_t *name, *newname;
updatectx_t *uctx;
isc_task_t *clone = NULL;
isc_task_t *tclone = NULL;
dns_section_t section = DNS_SECTION_UPDATE;
isc_sockaddr_t *server, *sa = NULL;
dns_tsectype_t tsectype = dns_tsectype_none;
......@@ -2811,8 +2811,8 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
isc_mem_put(client->mctx, uctx, sizeof(*uctx));
return (ISC_R_NOMEMORY);
}
clone = NULL;
isc_task_attach(task, &clone);
tclone = NULL;
isc_task_attach(task, &tclone);
uctx->client = client;
ISC_LINK_INIT(uctx, link);
uctx->state = dns_clientupdatestate_prepare;
......@@ -2840,7 +2840,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
if (tsec != NULL)
dns_tsec_getkey(tsec, &uctx->tsigkey);
uctx->event = (dns_clientupdateevent_t *)
isc_event_allocate(client->mctx, clone, DNS_EVENT_UPDATEDONE,
isc_event_allocate(client->mctx, tclone, DNS_EVENT_UPDATEDONE,
action, arg, sizeof(*uctx->event));
if (uctx->event == NULL)
goto fail;
......@@ -2954,7 +2954,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
isc_event_free(ISC_EVENT_PTR(&uctx->event));
if (uctx->tsigkey != NULL)
dns_tsigkey_detach(&uctx->tsigkey);
isc_task_detach(&clone);
isc_task_detach(&tclone);
DESTROYLOCK(&uctx->lock);
uctx->magic = 0;
isc_mem_put(client->mctx, uctx, sizeof(*uctx));
......
......@@ -167,16 +167,16 @@ dns_dbtable_detach(dns_dbtable_t **dbtablep) {
isc_result_t
dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db) {
isc_result_t result;
dns_db_t *clone;
dns_db_t *dbclone;
REQUIRE(VALID_DBTABLE(dbtable));
REQUIRE(dns_db_class(db) == dbtable->rdclass);
clone = NULL;
dns_db_attach(db, &clone);
dbclone = NULL;
dns_db_attach(db, &dbclone);
RWLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
result = dns_rbt_addname(dbtable->rbt, dns_db_origin(clone), clone);
result = dns_rbt_addname(dbtable->rbt, dns_db_origin(dbclone), dbclone);
RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write);
return (result);
......
......@@ -509,7 +509,7 @@ dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
dns_name_t tname;
dns_rdatatype_t ttype;
dns_trust_t trust = dns_trust_none;
dns_rdataset_t clone;
dns_rdataset_t rclone;
REQUIRE(ncacherdataset != NULL);
REQUIRE(ncacherdataset->type == 0);
......@@ -518,11 +518,11 @@ dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
REQUIRE(!dns_rdataset_isassociated(rdataset));
REQUIRE(type != dns_rdatatype_rrsig);
dns_rdataset_init(&clone);
dns_rdataset_clone(ncacherdataset, &clone);
result = dns_rdataset_first(&clone);
dns_rdataset_init(&rclone);
dns_rdataset_clone(ncacherdataset, &rclone);
result = dns_rdataset_first(&rclone);
while (result == ISC_R_SUCCESS) {
dns_rdataset_current(&clone, &rdata);
dns_rdataset_current(&rclone, &rdata);
isc_buffer_init(&source, rdata.data, rdata.length);
isc_buffer_add(&source, rdata.length);
dns_name_init(&tname, NULL);
......@@ -541,10 +541,10 @@ dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
isc_buffer_remainingregion(&source, &remaining);
break;
}
result = dns_rdataset_next(&clone);
result = dns_rdataset_next(&rclone);
dns_rdata_reset(&rdata);
}
dns_rdataset_disassociate(&clone);
dns_rdataset_disassociate(&rclone);
if (result == ISC_R_NOMORE)
return (ISC_R_NOTFOUND);
if (result != ISC_R_SUCCESS)
......@@ -579,7 +579,7 @@ dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
dns_name_t tname;
dns_rdata_rrsig_t rrsig;
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_rdataset_t clone;
dns_rdataset_t rclone;
dns_rdatatype_t type;
dns_trust_t trust = dns_trust_none;
isc_buffer_t source;
......@@ -594,11 +594,11 @@ dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
REQUIRE(name != NULL);
REQUIRE(!dns_rdataset_isassociated(rdataset));
dns_rdataset_init(&clone);
dns_rdataset_clone(ncacherdataset, &clone);
result = dns_rdataset_first(&clone);
dns_rdataset_init(&rclone);
dns_rdataset_clone(ncacherdataset, &rclone);
result = dns_rdataset_first(&rclone);
while (result == ISC_R_SUCCESS) {
dns_rdataset_current(&clone, &rdata);
dns_rdataset_current(&rclone, &rdata);
isc_buffer_init(&source, rdata.data, rdata.length);
isc_buffer_add(&source, rdata.length);
dns_name_init(&tname, NULL);
......@@ -614,7 +614,7 @@ dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
if (type != dns_rdatatype_rrsig ||
!dns_name_equal(&tname, name)) {
result = dns_rdataset_next(&clone);
result = dns_rdataset_next(&rclone);
dns_rdata_reset(&rdata);
continue;
}
......@@ -640,10 +640,10 @@ dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
break;
}
result = dns_rdataset_next(&clone);
result = dns_rdataset_next(&rclone);
dns_rdata_reset(&rdata);
}
dns_rdataset_disassociate(&clone);
dns_rdataset_disassociate(&rclone);
if (result == ISC_R_NOMORE)
return (ISC_R_NOTFOUND);
if (result != ISC_R_SUCCESS)
......
......@@ -207,7 +207,7 @@ void
dns_requestmgr_whenshutdown(dns_requestmgr_t *requestmgr, isc_task_t *task,
isc_event_t **eventp)
{
isc_task_t *clone;
isc_task_t *tclone;
isc_event_t *event;
req_log(ISC_LOG_DEBUG(3), "dns_requestmgr_whenshutdown");
......@@ -227,9 +227,9 @@ dns_requestmgr_whenshutdown(dns_requestmgr_t *requestmgr, isc_task_t *task,
event->ev_sender = requestmgr;
isc_task_send(task, &event);
} else {
clone = NULL;
isc_task_attach(task, &clone);
event->ev_sender = clone;
tclone = NULL;
isc_task_attach(task, &tclone);
event->ev_sender = tclone;
ISC_LIST_APPEND(requestmgr->whenshutdown, event, ev_link);
}
UNLOCK(&requestmgr->lock);
......
......@@ -4138,7 +4138,7 @@ fctx_join(fetchctx_t *fctx, isc_task_t *task, isc_sockaddr_t *client,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset,
dns_fetch_t *fetch)
{
isc_task_t *clone;
isc_task_t *tclone;
dns_fetchevent_t *event;
FCTXTRACE("join");
......@@ -4148,13 +4148,13 @@ fctx_join(fetchctx_t *fctx, isc_task_t *task, isc_sockaddr_t *client,
* sender field. We'll make the fetch the sender when we actually
* send the event.
*/
clone = NULL;
isc_task_attach(task, &clone);
tclone = NULL;
isc_task_attach(task, &tclone);
event = (dns_fetchevent_t *)
isc_event_allocate(fctx->res->mctx, clone, DNS_EVENT_FETCHDONE,
isc_event_allocate(fctx->res->mctx, tclone, DNS_EVENT_FETCHDONE,
action, arg, sizeof(*event));
if (event == NULL) {
isc_task_detach(&clone);
isc_task_detach(&tclone);
return (ISC_R_NOMEMORY);
}
event->result = DNS_R_SERVFAIL;
......@@ -9145,7 +9145,7 @@ void
dns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task,
isc_event_t **eventp)
{
isc_task_t *clone;
isc_task_t *tclone;
isc_event_t *event;
REQUIRE(VALID_RESOLVER(res));
......@@ -9163,9 +9163,9 @@ dns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task,
event->ev_sender = res;
isc_task_send(task, &event);
} else {
clone = NULL;
isc_task_attach(task, &clone);
event->ev_sender = clone;
tclone = NULL;
isc_task_attach(task, &tclone);
event->ev_sender = tclone;
ISC_LIST_APPEND(res->whenshutdown, event, ev_link);
}
......
......@@ -1136,15 +1136,15 @@ sync_channellist(isc_logconfig_t *lcfg) {
static isc_result_t
greatest_version(isc_logchannel_t *channel, int *greatestp) {
/* XXXDCL HIGHLY NT */
char *basename, *digit_end;
char *bname, *digit_end;
const char *dirname;
int version, greatest = -1;
size_t basenamelen;
size_t bnamelen;
isc_dir_t dir;
isc_result_t result;
char sep = '/';
#ifdef _WIN32
char *basename2;
char *bname2;
#endif
REQUIRE(channel->type == ISC_LOG_TOFILE);
......@@ -1153,23 +1153,23 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
* It is safe to DE_CONST the file.name because it was copied
* with isc_mem_strdup in isc_log_createchannel.
*/
basename = strrchr(FILE_NAME(channel), sep);
bname = strrchr(FILE_NAME(channel), sep);
#ifdef _WIN32
basename2 = strrchr(FILE_NAME(channel), '\\');
if ((basename != NULL && basename2 != NULL && basename2 > basename) ||
(basename == NULL && basename2 != NULL)) {
basename = basename2;
bname2 = strrchr(FILE_NAME(channel), '\\');
if ((bname != NULL && bname2 != NULL && bname2 > bname) ||
(bname == NULL && bname2 != NULL)) {
bname = bname2;
sep = '\\';
}
#endif
if (basename != NULL) {
*basename++ = '\0';
if (bname != NULL) {
*bname++ = '\0';
dirname = FILE_NAME(channel);
} else {
DE_CONST(FILE_NAME(channel), basename);
DE_CONST(FILE_NAME(channel), bname);
dirname = ".";
}
basenamelen = strlen(basename);
bnamelen = strlen(bname);
isc_dir_init(&dir);
result = isc_dir_open(&dir, dirname);
......@@ -1177,8 +1177,8 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
/*
* Replace the file separator if it was taken out.
*/
if (basename != FILE_NAME(channel))
*(basename - 1) = sep;
if (bname != FILE_NAME(channel))
*(bname - 1) = sep;
/*
* Return if the directory open failed.
......@@ -1187,11 +1187,11 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
return (result);
while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
if (dir.entry.length > basenamelen &&
strncmp(dir.entry.name, basename, basenamelen) == 0 &&
dir.entry.name[basenamelen] == '.') {
if (dir.entry.length > bnamelen &&
strncmp(dir.entry.name, bname, bnamelen) == 0 &&
dir.entry.name[bnamelen] == '.') {
version = strtol(&dir.entry.name[basenamelen + 1],
version = strtol(&dir.entry.name[bnamelen + 1],
&digit_end, 10);
if (*digit_end == '\0' && version > greatest)
greatest = version;
......
......@@ -614,7 +614,7 @@ isc_file_safecreate(const char *filename, FILE **fp) {
isc_result_t
isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
char const **basename)
char const **bname)
{
char *dir;
const char *file, *slash;
......@@ -646,7 +646,7 @@ isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname,
}
*dirname = dir;
*basename = file;
*bname = file;
return (ISC_R_SUCCESS);
}
......
......@@ -178,7 +178,7 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
const char *namespace)
{
struct addrinfo hints, *res;
int gai_error;
int gaierror;
isc_sockaddr_t sa;
isc_sockaddrlist_t servers;
isc_result_t result;
......@@ -192,10 +192,10 @@ addserver(dns_client_t *client, const char *addrstr, const char *port,
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_flags = AI_NUMERICHOST;
gai_error = getaddrinfo(addrstr, port, &hints, &res);
if (gai_error != 0) {
gaierror = getaddrinfo(addrstr, port, &hints, &res);
if (gaierror != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(gai_error));
gai_strerror(gaierror));
exit(1);
}
INSIST(res->ai_addrlen <= sizeof(sa.type));
......
......@@ -139,7 +139,7 @@ print_section(dns_message_t *message, int section, isc_buffer_t *buf) {
int
main(int argc, char *argv[]) {
int ch, i, gai_error;
int ch, i, gaierror;
struct addrinfo hints, *res;
isc_textregion_t tr;
dns_client_t *client = NULL;
......@@ -213,10 +213,10 @@ main(int argc, char *argv[]) {
#ifdef AI_NUMERICHOST
hints.ai_flags = AI_NUMERICHOST;
#endif
gai_error = getaddrinfo(argv[0], "53", &hints, &res);
if (gai_error != 0) {
gaierror = getaddrinfo(argv[0], "53", &hints, &res);
if (gaierror != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(gai_error));
gai_strerror(gaierror));
exit(1);
}
INSIST(res->ai_addrlen <= sizeof(sa.type));
......
......@@ -84,7 +84,7 @@ int
main(int argc, char *argv[]) {
int ch;
struct addrinfo hints, *res;
int gai_error;
int gaierror;
dns_client_t *client = NULL;
char *zonenamestr = NULL;
char *keyfilename = NULL;
......@@ -181,10 +181,10 @@ main(int argc, char *argv[]) {
#ifdef AI_NUMERICHOST
hints.ai_flags = AI_NUMERICHOST;
#endif
gai_error = getaddrinfo(auth_server, "53", &hints, &res);
if (gai_error != 0) {
gaierror = getaddrinfo(auth_server, "53", &hints, &res);
if (gaierror != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(gai_error));
gai_strerror(gaierror));
exit(1);
}
INSIST(res->ai_addrlen <= sizeof(sa_auth.type));
......@@ -205,10 +205,10 @@ main(int argc, char *argv[]) {
#ifdef AI_NUMERICHOST
hints.ai_flags = AI_NUMERICHOST;
#endif
gai_error = getaddrinfo(recursive_server, "53", &hints, &res);
if (gai_error != 0) {
gaierror = getaddrinfo(recursive_server, "53", &hints, &res);
if (gaierror != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n",
gai_strerror(gai_error));
gai_strerror(gaierror));
exit(1);
}
INSIST(res->ai_addrlen <= sizeof(sa_recursive.type));
......
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