aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2021-10-06 22:35:07 -0800
committerDavid M. Syzdek <david@syzdek.net>2021-10-06 22:35:07 -0800
commit36d0ffe2f53c5c959e8618c5e1dfb559c8c80f89 (patch)
tree57d9cb10a834eeec93549d7910433d639bd19bf6
parent5bc0c846785a3ebb0964da9f2adf281a559e9658 (diff)
downloaddmstools-36d0ffe2f53c5c959e8618c5e1dfb559c8c80f89.tar.gz
dmstools-36d0ffe2f53c5c959e8618c5e1dfb559c8c80f89.tar.bz2
dmstools-36d0ffe2f53c5c959e8618c5e1dfb559c8c80f89.tar.xz
dmstools-36d0ffe2f53c5c959e8618c5e1dfb559c8c80f89.zip
netcalc: fixing Xcode analyzer warnings
-rw-r--r--src/netcalc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/netcalc.c b/src/netcalc.c
index 3b0cec2..2ec69c5 100644
--- a/src/netcalc.c
+++ b/src/netcalc.c
@@ -458,7 +458,6 @@ void netcalc_ip_free( netcalc_ip * ip )
458 458
459int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr ) 459int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr )
460{ 460{
461 int rc;
462 netcalc_ip * ip; 461 netcalc_ip * ip;
463 char * ptr; 462 char * ptr;
464 char * endptr; 463 char * endptr;
@@ -495,16 +494,16 @@ int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr )
495 }; 494 };
496 495
497 // parses string 496 // parses string
498 if ((ptr = strchr(str, ':')) == NULL) 497 if (strchr(str, ':') == NULL)
499 { 498 {
500 if ((rc = netcalc_ip_parse_ipv4(cnf, ip, str)) != 0) 499 if (netcalc_ip_parse_ipv4(cnf, ip, str) != 0)
501 { 500 {
502 netcalc_ip_free(ip); 501 netcalc_ip_free(ip);
503 free(str); 502 free(str);
504 return(1); 503 return(1);
505 }; 504 };
506 } else { 505 } else {
507 if ((rc = netcalc_ip_parse_ipv6(cnf, ip, str)) != 0) 506 if (netcalc_ip_parse_ipv6(cnf, ip, str) != 0)
508 { 507 {
509 netcalc_ip_free(ip); 508 netcalc_ip_free(ip);
510 free(str); 509 free(str);
@@ -1247,7 +1246,6 @@ void netcalc_version(void)
1247int main(int argc, char * argv[]) 1246int main(int argc, char * argv[])
1248{ 1247{
1249 int c; 1248 int c;
1250 int rc;
1251 int opt_index; 1249 int opt_index;
1252 netcalc * cnf; 1250 netcalc * cnf;
1253 netcalc_ip * ip; 1251 netcalc_ip * ip;
@@ -1261,7 +1259,7 @@ int main(int argc, char * argv[])
1261 {NULL, 0, 0, 0 } 1259 {NULL, 0, 0, 0 }
1262 }; 1260 };
1263 1261
1264 if ((rc = netcalc_init(&cnf)) != 0) 1262 if (netcalc_init(&cnf) != 0)
1265 return(1); 1263 return(1);
1266 1264
1267 while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1) 1265 while((c = getopt_long(argc, argv, short_opt, long_opt, &opt_index)) != -1)
@@ -1361,13 +1359,13 @@ int main(int argc, char * argv[])
1361 1359
1362 for(c = optind; c < argc; c++) 1360 for(c = optind; c < argc; c++)
1363 { 1361 {
1364 if ((rc = netcalc_ip_parse(cnf, &ip, argv[c])) != 0) 1362 if (netcalc_ip_parse(cnf, &ip, argv[c]) != 0)
1365 { 1363 {
1366 netcalc_free(cnf); 1364 netcalc_free(cnf);
1367 return(1); 1365 return(1);
1368 }; 1366 };
1369 1367
1370 if ((rc = netcalc_ip_append(cnf, ip)) != 0) 1368 if (netcalc_ip_append(cnf, ip) != 0)
1371 { 1369 {
1372 netcalc_ip_free(ip); 1370 netcalc_ip_free(ip);
1373 netcalc_free(cnf); 1371 netcalc_free(cnf);
@@ -1408,7 +1406,7 @@ int main(int argc, char * argv[])
1408 }; 1406 };
1409 1407
1410 // calculate inclusive CIDR 1408 // calculate inclusive CIDR
1411 while ((rc = netcalc_net_cmp(cnf->lower, cnf->upper, cnf->cidr)) != 0) 1409 while (netcalc_net_cmp(cnf->lower, cnf->upper, cnf->cidr) != 0)
1412 cnf->cidr--; 1410 cnf->cidr--;
1413 netcalc_net_network_r(cnf->superblock, cnf->lower, cnf->cidr); 1411 netcalc_net_network_r(cnf->superblock, cnf->lower, cnf->cidr);
1414 1412