]> granicus.if.org Git - sudo/commitdiff
Replace bare ";" in the body of for() loops with "continue;" for
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Oct 2016 16:42:28 +0000 (10:42 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Oct 2016 16:42:28 +0000 (10:42 -0600)
improved readability.

lib/util/strlcpy.c
lib/util/strnlen.c
plugins/sudoers/defaults.c
plugins/sudoers/env.c
plugins/sudoers/logging.c
plugins/sudoers/visudo_json.c
src/env_hooks.c
src/exec_pty.c

index c898ea2bb3dc01dc07957cf4f7e5fbf8ed7f66c9..11f6693af80307012a4b78807fd9baac002db9c1 100644 (file)
@@ -49,7 +49,7 @@ sudo_strlcpy(char *dst, const char *src, size_t dsize)
                if (dsize != 0)
                        *dst = '\0';            /* NUL-terminate dst */
                while (*src++)
-                       ;
+                       continue;
        }
 
        return(src - osrc - 1); /* count does not include NUL */
index 20ffb3f2b63ea17bdc08f37b964f4bb009b6ac9f..be6816115d2cb8983b7472e91f59772812c7b31c 100644 (file)
@@ -30,7 +30,7 @@ sudo_strnlen(const char *str, size_t maxlen)
        const char *cp;
 
        for (cp = str; maxlen != 0 && *cp != '\0'; cp++, maxlen--)
-               ;
+               continue;
 
        return (size_t)(cp - str);
 }
index 6ee93d3d757bfdd0e76bcb6f85b1ff76e4daa0fb..d21b83f89817b398c88cae170a59694e29f7ea65 100644 (file)
@@ -867,7 +867,7 @@ store_syslogfac(const char *val, struct sudo_defs_types *def)
        debug_return_bool(true);
     }
     for (fac = facilities; fac->name && strcmp(val, fac->name); fac++)
-       ;
+       continue;
     if (fac->name == NULL)
        debug_return_bool(false);               /* not found */
 
@@ -882,7 +882,7 @@ logfac2str(int n)
     debug_decl(logfac2str, SUDOERS_DEBUG_DEFAULTS)
 
     for (fac = facilities; fac->name && fac->num != n; fac++)
-       ;
+       continue;
     debug_return_const_str(fac->name);
 }
 
@@ -896,7 +896,7 @@ store_syslogpri(const char *val, struct sudo_defs_types *def)
        debug_return_bool(false);
 
     for (pri = priorities; pri->name && strcmp(val, pri->name); pri++)
-       ;
+       continue;
     if (pri->name == NULL)
        debug_return_bool(false);       /* not found */
 
@@ -911,7 +911,7 @@ logpri2str(int n)
     debug_decl(logpri2str, SUDOERS_DEBUG_DEFAULTS)
 
     for (pri = priorities; pri->name && pri->num != n; pri++)
-       ;
+       continue;
     debug_return_const_str(pri->name);
 }
 
index 6be2e53913b470b57c64053fcb1b3fdd7d23ca89..dd11e10a577e8843911704dd13fa2f463918116f 100644 (file)
@@ -448,7 +448,7 @@ sudo_setenv_nodebug(const char *var, const char *val, int overwrite)
      * just ignores the '=' and anything after it.
      */
     for (cp = var; *cp && *cp != '='; cp++)
-       ;
+       continue;
     esize = (size_t)(cp - var) + 2;
     if (val) {
        esize += strlen(val);   /* glibc treats a NULL val as "" */
@@ -1199,7 +1199,7 @@ read_env_file(const char *path, int overwrite)
 
        /* Must be of the form name=["']value['"] */
        for (val = var; *val != '\0' && *val != '='; val++)
-           ;
+           continue;
        if (var == val || *val != '=')
            continue;
        var_len = (size_t)(val - var);
index 78da001f0dddec69ddc89a4f6cb552c248eeb56f..ff83ab8314055b1b857ac988ce653489332cf808 100644 (file)
@@ -122,7 +122,7 @@ do_syslog(int pri, char *msg)
 
            /* Advance p and eliminate leading whitespace */
            for (p = tmp; *p == ' '; p++)
-               ;
+               continue;
        } else {
            mysyslog(pri, fmt, user_name, p);
            p += len;
index 584b37802d7ada12613cd957701613df18960023..16c188ac656c2b6939a73742f0f374559c0ef63c 100644 (file)
@@ -573,13 +573,13 @@ print_defaults_list_json(FILE *fp, struct defaults *def, int indent)
     do {
        /* Remove leading blanks, must have a non-empty string. */
        for (start = end; isblank((unsigned char)*start); start++)
-           ;
+           continue;
        if (*start == '\0')
            break;
 
        /* Find the end and print it. */
        for (end = start; *end && !isblank((unsigned char)*end); end++)
-           ;
+           continue;
        savech = *end;
        *end = '\0';
        print_string_json(fp, start);
index 00c0cea25e5def6524eab15b0fc603a206ecae0e..adb1e2cadb7b11a061c08e588e4a1a6c113866fc 100644 (file)
@@ -160,7 +160,7 @@ rpl_setenv(const char *var, const char *val, int overwrite)
      * just ignores the '=' and anything after it.
      */
     for (src = var; *src != '\0' && *src != '='; src++)
-       ;
+       continue;
     esize = (size_t)(src - var) + 2;
     if (val) {
         esize += strlen(val);  /* glibc treats a NULL val as "" */
index d6efa949b4a13d0d7fb4b08388f1fe427df49418..3b26368fe5eb94e33817fa9ae6b89c2f47d64856 100644 (file)
@@ -1557,7 +1557,7 @@ exec_pty(struct command_details *details,
     /* Wait for parent to grant us the tty if we are foreground. */
     if (foreground && !ISSET(details->flags, CD_EXEC_BG)) {
        while (tcgetpgrp(io_fds[SFD_SLAVE]) != self)
-           ; /* spin */
+           continue; /* spin */
     }
 
     /* We have guaranteed that the slave fd is > 2 */