From 78607f8b51e865acc5bf5377bc3f576d3d041869 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 30 May 2017 07:05:22 +0000 Subject: [PATCH] fix -Wshadow warnings. Found by bcallah, thanks! --- usr.bin/mg/dir.c | 12 ++++++------ usr.bin/mg/fileio.c | 4 ++-- usr.bin/mg/modes.c | 8 ++++---- usr.bin/mg/re_search.c | 8 ++++---- usr.bin/mg/search.c | 16 ++++++++-------- usr.bin/mg/tags.c | 8 ++++---- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/usr.bin/mg/dir.c b/usr.bin/mg/dir.c index bcbab5c12f7..0caaf16d92d 100644 --- a/usr.bin/mg/dir.c +++ b/usr.bin/mg/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.29 2016/09/12 18:32:54 millert Exp $ */ +/* $OpenBSD: dir.c,v 1.30 2017/05/30 07:05:22 florian Exp $ */ /* This file is in the public domain. */ @@ -117,7 +117,7 @@ do_makedir(char *path) { struct stat sb; int finished, ishere; - mode_t dir_mode, mode, oumask; + mode_t dir_mode, f_mode, oumask; char *slash; if ((path = adjustname(path, TRUE)) == NULL) @@ -131,8 +131,8 @@ do_makedir(char *path) slash = path; oumask = umask(0); - mode = 0777 & ~oumask; - dir_mode = mode | S_IWUSR | S_IXUSR; + f_mode = 0777 & ~oumask; + dir_mode = f_mode | S_IWUSR | S_IXUSR; for (;;) { slash += strspn(slash, "/"); @@ -152,8 +152,8 @@ do_makedir(char *path) continue; } - if (mkdir(path, finished ? mode : dir_mode) == 0) { - if (mode > 0777 && chmod(path, mode) < 0) { + if (mkdir(path, finished ? f_mode : dir_mode) == 0) { + if (f_mode > 0777 && chmod(path, f_mode) < 0) { umask(oumask); return (ABORT); } diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 1888fd039ca..0987f6f30de 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.103 2016/07/28 21:40:25 tedu Exp $ */ +/* $OpenBSD: fileio.c,v 1.104 2017/05/30 07:05:22 florian Exp $ */ /* This file is in the public domain. */ @@ -215,6 +215,7 @@ int fbackupfile(const char *fn) { struct stat sb; + struct timespec new_times[2]; int from, to, serrno; ssize_t nread; char buf[BUFSIZ]; @@ -268,7 +269,6 @@ fbackupfile(const char *fn) (void) fchmod(to, (sb.st_mode & 0777)); /* copy the mtime to the backupfile */ - struct timespec new_times[2]; new_times[0] = sb.st_atim; new_times[1] = sb.st_mtim; futimens(to, new_times); diff --git a/usr.bin/mg/modes.c b/usr.bin/mg/modes.c index 027a5cd8f65..9d5e4ce5373 100644 --- a/usr.bin/mg/modes.c +++ b/usr.bin/mg/modes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modes.c,v 1.20 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: modes.c,v 1.21 2017/05/30 07:05:22 florian Exp $ */ /* This file is in the public domain. */ @@ -23,14 +23,14 @@ struct maps_s *defb_modes[PBMODES] = { &fundamental_mode }; int defb_flag = 0; int -changemode(int f, int n, char *mode) +changemode(int f, int n, char *newmode) { int i; struct maps_s *m; - if ((m = name_mode(mode)) == NULL) { + if ((m = name_mode(newmode)) == NULL) { dobeep(); - ewprintf("Can't find mode %s", mode); + ewprintf("Can't find mode %s", newmode); return (FALSE); } if (!(f & FFARG)) { diff --git a/usr.bin/mg/re_search.c b/usr.bin/mg/re_search.c index 287030ad820..ea3158ace25 100644 --- a/usr.bin/mg/re_search.c +++ b/usr.bin/mg/re_search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re_search.c,v 1.31 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: re_search.c,v 1.32 2017/05/30 07:05:22 florian Exp $ */ /* This file is in the public domain. */ @@ -420,17 +420,17 @@ re_backsrch(void) * some do-it-yourself control expansion. */ static int -re_readpattern(char *prompt) +re_readpattern(char *re_prompt) { static int dofree = 0; int flags, error, s; char tpat[NPAT], *rep; if (re_pat[0] == '\0') - rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, prompt); + rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, re_prompt); else rep = eread("%s: (default %s) ", tpat, NPAT, - EFNUL | EFNEW | EFCR, prompt, re_pat); + EFNUL | EFNEW | EFCR, re_prompt, re_pat); if (rep == NULL) return (ABORT); if (rep[0] != '\0') { diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c index 161435e88d3..2abce1866d5 100644 --- a/usr.bin/mg/search.c +++ b/usr.bin/mg/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.44 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: search.c,v 1.45 2017/05/30 07:05:22 florian Exp $ */ /* This file is in the public domain. */ @@ -542,16 +542,16 @@ is_prompt(int dir, int flag, int success) } /* - * Prompt writing routine for the incremental search. The "prompt" is just + * Prompt writing routine for the incremental search. The "i_prompt" is just * a string. The "flag" determines whether pat should be printed. */ static void -is_dspl(char *prompt, int flag) +is_dspl(char *i_prompt, int flag) { if (flag != FALSE) - ewprintf("%s: ", prompt); + ewprintf("%s: ", i_prompt); else - ewprintf("%s: %s", prompt, pat); + ewprintf("%s: %s", i_prompt, pat); } /* @@ -830,16 +830,16 @@ eq(int bc, int pc, int xcase) * expansion. */ int -readpattern(char *prompt) +readpattern(char *r_prompt) { char tpat[NPAT], *rep; int retval; if (pat[0] == '\0') - rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, prompt); + rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, r_prompt); else rep = eread("%s: (default %s) ", tpat, NPAT, - EFNUL | EFNEW | EFCR, prompt, pat); + EFNUL | EFNEW | EFCR, r_prompt, pat); /* specified */ if (rep == NULL) { diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c index c8697471fd0..24cbb50123a 100644 --- a/usr.bin/mg/tags.c +++ b/usr.bin/mg/tags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tags.c,v 1.14 2016/09/01 10:01:53 sunil Exp $ */ +/* $OpenBSD: tags.c,v 1.15 2017/05/30 07:05:22 florian Exp $ */ /* * This file is in the public domain. @@ -402,18 +402,18 @@ cleanup: * Search through each line of buffer for pattern. */ int -searchpat(char *pat) +searchpat(char *s_pat) { struct line *lp; int dotline; size_t plen; - plen = strlen(pat); + plen = strlen(s_pat); dotline = 1; lp = lforw(curbp->b_headp); while (lp != curbp->b_headp) { if (ltext(lp) != NULL && plen <= llength(lp) && - (strncmp(pat, ltext(lp), plen) == 0)) { + (strncmp(s_pat, ltext(lp), plen) == 0)) { curwp->w_doto = 0; curwp->w_dotp = lp; curwp->w_dotline = dotline; -- 2.20.1