]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
remove or comment empty conditional branches
authorEvan Hunt <each@isc.org>
Tue, 10 Mar 2020 01:23:13 +0000 (18:23 -0700)
committerEvan Hunt <each@isc.org>
Tue, 17 Mar 2020 22:39:03 +0000 (15:39 -0700)
some empty conditional branches which contained a semicolon were
"fixed" by clang-format to contain nothing. add comments to prevent this.

(cherry picked from commit 735be3b816913f8fae3153366ec89e5511ff52b4)

bin/named/zoneconf.c
lib/dns/rdata/in_1/wks_11.c

index 6a28cf83ae8da2dda2c7ff62f6add2ec38574c1b..e01b095bb448a04e6876ebf8c61c3a879dc1c1d0 100644 (file)
@@ -1442,7 +1442,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                        } else if (strcasecmp(arg, "maintain") == 0) {
                                allow = maint = true;
                        } else if (strcasecmp(arg, "off") == 0) {
-                               ;
+                               /* Default */
                        } else {
                                INSIST(0);
                                ISC_UNREACHABLE();
@@ -1591,7 +1591,7 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                                dns_zone_setkeyopt(zone, DNS_ZONEKEY_NORESIGN,
                                                   true);
                        } else if (strcasecmp(arg, "maintain") == 0) {
-                               ;
+                               /* Default */
                        } else {
                                INSIST(0);
                                ISC_UNREACHABLE();
index 8ad0bf6ea1bbbcd4adefc361054093bddfef2125..ed77c2f2d07c755e65727e74243b7b6d9701d332 100644 (file)
@@ -73,7 +73,7 @@ fromtext_in_wks(ARGS_FROMTEXT) {
        isc_token_t token;
        isc_region_t region;
        struct in_addr addr;
-       char *e;
+       char *e = NULL;
        long proto;
        unsigned char bm[8*1024]; /* 64k bits */
        long port;
@@ -115,10 +115,12 @@ fromtext_in_wks(ARGS_FROMTEXT) {
                                      false));
 
        isc_buffer_availableregion(target, &region);
-       if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
+       if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1) {
                CHECKTOK(DNS_R_BADDOTTEDQUAD);
-       if (region.length < 4)
+       }
+       if (region.length < 4) {
                return (ISC_R_NOSPACE);
+       }
        memmove(region.base, &addr, 4);
        isc_buffer_add(target, 4);
 
@@ -129,18 +131,19 @@ fromtext_in_wks(ARGS_FROMTEXT) {
                                      false));
 
        proto = strtol(DNS_AS_STR(token), &e, 10);
-       if (*e == 0)
-               ;
-       else if (!mygetprotobyname(DNS_AS_STR(token), &proto))
+       if (*e != '\0' && !mygetprotobyname(DNS_AS_STR(token), &proto)) {
                CHECKTOK(DNS_R_UNKNOWNPROTO);
+       }
 
-       if (proto < 0 || proto > 0xff)
+       if (proto < 0 || proto > 0xff) {
                CHECKTOK(ISC_R_RANGE);
+       }
 
-       if (proto == IPPROTO_TCP)
+       if (proto == IPPROTO_TCP) {
                ps = "tcp";
-       else if (proto == IPPROTO_UDP)
+       } else if (proto == IPPROTO_UDP) {
                ps = "udp";
+       }
 
        CHECK(uint8_tobuffer(proto, target));
 
@@ -148,8 +151,9 @@ fromtext_in_wks(ARGS_FROMTEXT) {
        do {
                CHECK(isc_lex_getmastertoken(lexer, &token,
                                              isc_tokentype_string, true));
-               if (token.type != isc_tokentype_string)
+               if (token.type != isc_tokentype_string) {
                        break;
+               }
 
                /*
                 * Lowercase the service string as some getservbyname() are
@@ -161,15 +165,18 @@ fromtext_in_wks(ARGS_FROMTEXT) {
                                service[i] = tolower(service[i]&0xff);
 
                port = strtol(DNS_AS_STR(token), &e, 10);
-               if (*e == 0)
-                       ;
-               else if (!mygetservbyname(service, ps, &port) &&
-                        !mygetservbyname(DNS_AS_STR(token), ps, &port))
+               if (*e != 0 && !mygetservbyname(service, ps, &port) &&
+                   !mygetservbyname(DNS_AS_STR(token), ps, &port))
+               {
                        CHECKTOK(DNS_R_UNKNOWNSERVICE);
-               if (port < 0 || port > 0xffff)
+               }
+
+               if (port < 0 || port > 0xffff) {
                        CHECKTOK(ISC_R_RANGE);
-               if (port > maxport)
+               }
+               if (port > maxport) {
                        maxport = port;
+               }
                bm[port / 8] |= (0x80 >> (port % 8));
        } while (1);