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:
Dimitry Andric 2019-02-10 13:34:21 +00:00
parent d0f687d30f
commit 2f301637c8
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
MAN= top.1
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000
NO_WERROR=
.endif
LIBADD= ncursesw m kvm jail util sbuf
.include <bsd.prog.mk>

View File

@ -70,7 +70,7 @@ username(int uid)
}
int
userid(char username[])
userid(char username_[])
{
struct passwd *pwd;
@ -78,13 +78,13 @@ userid(char username[])
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);
}
/* 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(pwd->pw_uid);

View File

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