svn commit: r343958 - head/usr.bin/top

Dimitry Andric dim at FreeBSD.org
Sun Feb 10 13:34:23 UTC 2019


Author: dim
Date: Sun Feb 10 13:34:21 2019
New Revision: 343958
URL: https://svnweb.freebsd.org/changeset/base/343958

Log:
  Fix multiple warnings in usr.bin/top about variables shadowing global
  declarations from base gcc, by renaming those variables.
  
  MFC after:	1 week

Modified:
  head/usr.bin/top/Makefile
  head/usr.bin/top/username.c
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/Makefile
==============================================================================
--- head/usr.bin/top/Makefile	Sun Feb 10 13:31:08 2019	(r343957)
+++ head/usr.bin/top/Makefile	Sun Feb 10 13:34:21 2019	(r343958)
@@ -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>

Modified: head/usr.bin/top/username.c
==============================================================================
--- head/usr.bin/top/username.c	Sun Feb 10 13:31:08 2019	(r343957)
+++ head/usr.bin/top/username.c	Sun Feb 10 13:34:21 2019	(r343958)
@@ -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);

Modified: head/usr.bin/top/utils.c
==============================================================================
--- head/usr.bin/top/utils.c	Sun Feb 10 13:31:08 2019	(r343957)
+++ head/usr.bin/top/utils.c	Sun Feb 10 13:34:21 2019	(r343958)
@@ -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);
 }


More information about the svn-src-head mailing list