2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

We use too old Visual Compiler to use scoped variables

This commit is contained in:
Ondřej Surý
2018-04-11 15:16:34 +02:00
parent 96a07ba867
commit 5311a3b7b5
7 changed files with 9 additions and 10 deletions

View File

@@ -733,7 +733,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
dig_lookup_t *lookup) dig_lookup_t *lookup)
{ {
isc_result_t result; isc_result_t result;
char *cmd, *value, *last, *code; char *cmd, *value, *last, *code, *extra;
isc_uint32_t num; isc_uint32_t num;
isc_boolean_t state = ISC_TRUE; isc_boolean_t state = ISC_TRUE;
size_t n; size_t n;
@@ -1003,7 +1003,6 @@ plus_option(char *option, isc_boolean_t is_batchfile,
"specified"); "specified");
goto exit_or_usage; goto exit_or_usage;
} }
char *extra;
code = strtok_r(value, ":", &last); code = strtok_r(value, ":", &last);
extra = strtok_r(NULL, "\0", &last); extra = strtok_r(NULL, "\0", &last);
save_opt(lookup, code, extra); save_opt(lookup, code, extra);
@@ -2137,6 +2136,7 @@ query_finished(void) {
char batchline[MXNAME]; char batchline[MXNAME];
int bargc; int bargc;
char *bargv[16]; char *bargv[16];
char *last;
if (batchname == NULL) { if (batchname == NULL) {
isc_app_shutdown(); isc_app_shutdown();
@@ -2153,7 +2153,6 @@ query_finished(void) {
} }
if (fgets(batchline, sizeof(batchline), batchfp) != 0) { if (fgets(batchline, sizeof(batchline), batchfp) != 0) {
char *last;
debug("batch line %s", batchline); debug("batch line %s", batchline);
for (bargc = 1, bargv[bargc] = strtok_r(batchline, " \t\r\n", &last); for (bargc = 1, bargv[bargc] = strtok_r(batchline, " \t\r\n", &last);
bargc < 14 && bargv[bargc]; bargc < 14 && bargv[bargc];

View File

@@ -470,6 +470,7 @@ parse_command_line(int argc, char *argv[]) {
int ch; int ch;
int port; int port;
const char *p; const char *p;
char *last;
save_command_line(argc, argv); save_command_line(argc, argv);
@@ -607,7 +608,6 @@ parse_command_line(int argc, char *argv[]) {
else if (!strncmp(isc_commandline_argument, else if (!strncmp(isc_commandline_argument,
"mkeytimers=", 11)) "mkeytimers=", 11))
{ {
char *last;
p = strtok_r(isc_commandline_argument + 11, "/", &last); p = strtok_r(isc_commandline_argument + 11, "/", &last);
if (p == NULL) if (p == NULL)
named_main_earlyfatal("bad mkeytimer"); named_main_earlyfatal("bad mkeytimer");

View File

@@ -1741,6 +1741,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv)
int rc; int rc;
char **rv; char **rv;
isc_boolean_t global = ISC_TRUE; isc_boolean_t global = ISC_TRUE;
char *last;
/* /*
* The semantics for parsing the args is a bit complex; if * The semantics for parsing the args is a bit complex; if
@@ -1852,7 +1853,6 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv)
fatal("couldn't open batch file '%s'", batchname); fatal("couldn't open batch file '%s'", batchname);
} }
while (fgets(batchline, sizeof(batchline), batchfp) != 0) { while (fgets(batchline, sizeof(batchline), batchfp) != 0) {
char *last;
if (batchline[0] == '\r' || batchline[0] == '\n' if (batchline[0] == '\r' || batchline[0] == '\n'
|| batchline[0] == '#' || batchline[0] == ';') || batchline[0] == '#' || batchline[0] == ';')
continue; continue;

View File

@@ -108,6 +108,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
char *right_str = NULL; char *right_str = NULL;
query_list_t *tql; query_list_t *tql;
query_segment_t *tseg = NULL; query_segment_t *tseg = NULL;
char *last;
REQUIRE(querylist != NULL && *querylist == NULL); REQUIRE(querylist != NULL && *querylist == NULL);
REQUIRE(mctx != NULL); REQUIRE(mctx != NULL);
@@ -158,7 +159,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
* split string at the first "$". set query segment to * split string at the first "$". set query segment to
* left portion * left portion
*/ */
char *last = NULL; last = NULL;
tseg->sql = isc_mem_strdup(mctx, tseg->sql = isc_mem_strdup(mctx,
strtok_r(right_str, "$", &last)); strtok_r(right_str, "$", &last));
if (tseg->sql == NULL) { if (tseg->sql == NULL) {

View File

@@ -113,6 +113,7 @@ bdb_lookup(const char *zone, const char *name, void *dbdata,
isc_consttextregion_t ttltext; isc_consttextregion_t ttltext;
DBC *c; DBC *c;
DBT key, data; DBT key, data;
char *last;
UNUSED(zone); UNUSED(zone);
#ifdef DNS_CLIENTINFO_VERSION #ifdef DNS_CLIENTINFO_VERSION
@@ -137,7 +138,6 @@ bdb_lookup(const char *zone, const char *name, void *dbdata,
ret = c->c_get(c, &key, &data, DB_SET); ret = c->c_get(c, &key, &data, DB_SET);
while (ret == 0) { while (ret == 0) {
char *last;
((char *)key.data)[key.size] = 0; ((char *)key.data)[key.size] = 0;
((char *)data.data)[data.size] = 0; ((char *)data.data)[data.size] = 0;
ttltext.base = strtok_r((char *)data.data, " ", &last); ttltext.base = strtok_r((char *)data.data, " ", &last);

View File

@@ -1055,7 +1055,7 @@ static void
set_order(int family, int (**net_order)(const char *, int, struct addrinfo **, set_order(int family, int (**net_order)(const char *, int, struct addrinfo **,
int, int)) int, int))
{ {
char *order, *tok; char *order, *tok, *last;
int found; int found;
if (family) { if (family) {
@@ -1070,7 +1070,6 @@ set_order(int family, int (**net_order)(const char *, int, struct addrinfo **,
} else { } else {
order = getenv("NET_ORDER"); order = getenv("NET_ORDER");
found = 0; found = 0;
char *last;
for (tok = strtok_r(order, ":", &last); for (tok = strtok_r(order, ":", &last);
tok; tok;
tok = strtok_r(NULL, ":", &last)) tok = strtok_r(NULL, ":", &last))

View File

@@ -59,6 +59,7 @@ is_ntfs(const char * file) {
char *machinename; char *machinename;
char *sharename; char *sharename;
char filename[1024]; char filename[1024];
char *last;
REQUIRE(filename != NULL); REQUIRE(filename != NULL);
@@ -76,7 +77,6 @@ is_ntfs(const char * file) {
/* Copy 'c:\' or 'c:/' and NUL terminate. */ /* Copy 'c:\' or 'c:/' and NUL terminate. */
strlcpy(drive, filename, ISC_MIN(3 + 1, sizeof(drive))); strlcpy(drive, filename, ISC_MIN(3 + 1, sizeof(drive)));
} else if ((filename[0] == '\\') && (filename[1] == '\\')) { } else if ((filename[0] == '\\') && (filename[1] == '\\')) {
char *last;
/* Find the machine and share name and rebuild the UNC */ /* Find the machine and share name and rebuild the UNC */
strlcpy(tmpbuf, filename, sizeof(tmpbuf)); strlcpy(tmpbuf, filename, sizeof(tmpbuf));
machinename = strtok_r(tmpbuf, "\\", &last); machinename = strtok_r(tmpbuf, "\\", &last);