From fc1b4155d763ff07087b0dff0921c0d29aaec58f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 26 Oct 2016 10:42:28 -0600 Subject: [PATCH] Replace bare ";" in the body of for() loops with "continue;" for improved readability. --- lib/util/strlcpy.c | 2 +- lib/util/strnlen.c | 2 +- plugins/sudoers/defaults.c | 8 ++++---- plugins/sudoers/env.c | 4 ++-- plugins/sudoers/logging.c | 2 +- plugins/sudoers/visudo_json.c | 4 ++-- src/env_hooks.c | 2 +- src/exec_pty.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/util/strlcpy.c b/lib/util/strlcpy.c index c898ea2bb..11f6693af 100644 --- a/lib/util/strlcpy.c +++ b/lib/util/strlcpy.c @@ -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 */ diff --git a/lib/util/strnlen.c b/lib/util/strnlen.c index 20ffb3f2b..be6816115 100644 --- a/lib/util/strnlen.c +++ b/lib/util/strnlen.c @@ -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); } diff --git a/plugins/sudoers/defaults.c b/plugins/sudoers/defaults.c index 6ee93d3d7..d21b83f89 100644 --- a/plugins/sudoers/defaults.c +++ b/plugins/sudoers/defaults.c @@ -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); } diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c index 6be2e5391..dd11e10a5 100644 --- a/plugins/sudoers/env.c +++ b/plugins/sudoers/env.c @@ -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); diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 78da001f0..ff83ab831 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -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; diff --git a/plugins/sudoers/visudo_json.c b/plugins/sudoers/visudo_json.c index 584b37802..16c188ac6 100644 --- a/plugins/sudoers/visudo_json.c +++ b/plugins/sudoers/visudo_json.c @@ -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); diff --git a/src/env_hooks.c b/src/env_hooks.c index 00c0cea25..adb1e2cad 100644 --- a/src/env_hooks.c +++ b/src/env_hooks.c @@ -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 "" */ diff --git a/src/exec_pty.c b/src/exec_pty.c index d6efa949b..3b26368fe 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -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 */ -- 2.40.0