From 63902403518c404be9b78c05163bfb161373b3d5 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 10 Feb 2019 13:34:21 +0000 Subject: [PATCH] Fix multiple warnings in usr.bin/top about variables shadowing global declarations from base gcc, by renaming those variables. MFC after: 1 week --- usr.bin/top/Makefile | 4 ---- usr.bin/top/username.c | 6 +++--- usr.bin/top/utils.c | 6 +++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/usr.bin/top/Makefile b/usr.bin/top/Makefile index 148fd96c1914..d11b91273b50 100644 --- a/usr.bin/top/Makefile +++ b/usr.bin/top/Makefile @@ -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 diff --git a/usr.bin/top/username.c b/usr.bin/top/username.c index 3b15b6a2231e..be2efa8f2135 100644 --- a/usr.bin/top/username.c +++ b/usr.bin/top/username.c @@ -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); diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c index 1ac0d6ad1516..b3d4b15be28b 100644 --- a/usr.bin/top/utils.c +++ b/usr.bin/top/utils.c @@ -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); }