Fix multiple warnings in usr.bin/top about variables shadowing global

declarations from base gcc, by renaming those variables.

MFC after:	1 week
This commit is contained in:
dim 2019-02-10 13:34:21 +00:00
parent 24a0b90e26
commit 6390240351
3 changed files with 6 additions and 10 deletions

View File

@ -7,9 +7,5 @@ SRCS= commands.c display.c machine.c screen.c top.c \
username.c utils.c username.c utils.c
MAN= top.1 MAN= top.1
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000
NO_WERROR=
.endif
LIBADD= ncursesw m kvm jail util sbuf LIBADD= ncursesw m kvm jail util sbuf
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -70,7 +70,7 @@ username(int uid)
} }
int int
userid(char username[]) userid(char username_[])
{ {
struct passwd *pwd; struct passwd *pwd;
@ -78,13 +78,13 @@ userid(char username[])
but for now we just do it simply and remember just the result. but for now we just do it simply and remember just the result.
*/ */
if ((pwd = getpwnam(username)) == NULL) if ((pwd = getpwnam(username_)) == NULL)
{ {
return(-1); return(-1);
} }
/* enter the result in the hash table */ /* enter the result in the hash table */
enter_user(pwd->pw_uid, username, 1); enter_user(pwd->pw_uid, username_, 1);
/* return our result */ /* return our result */
return(pwd->pw_uid); return(pwd->pw_uid);

View File

@ -292,11 +292,11 @@ char *
format_k(int64_t amt) format_k(int64_t amt)
{ {
static char retarray[NUM_STRINGS][16]; static char retarray[NUM_STRINGS][16];
static int index = 0; static int index_ = 0;
char *ret; char *ret;
ret = retarray[index]; ret = retarray[index_];
index = (index + 1) % NUM_STRINGS; index_ = (index_ + 1) % NUM_STRINGS;
humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE); humanize_number(ret, 6, amt * 1024, "", HN_AUTOSCALE, HN_NOSPACE);
return (ret); return (ret);
} }