Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2018 01:32:28 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333908 - head/usr.bin/top
Message-ID:  <201805200132.w4K1WSQB081461@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Sun May 20 01:32:27 2018
New Revision: 333908
URL: https://svnweb.freebsd.org/changeset/base/333908

Log:
  top(1): remove use of 'register' keyword
  
  This keyword is meaningless is obscures future diffs that help clear up
  warnings in top.

Modified:
  head/usr.bin/top/commands.c
  head/usr.bin/top/display.c
  head/usr.bin/top/top.c
  head/usr.bin/top/username.c
  head/usr.bin/top/utils.c

Modified: head/usr.bin/top/commands.c
==============================================================================
--- head/usr.bin/top/commands.c	Sun May 20 01:30:19 2018	(r333907)
+++ head/usr.bin/top/commands.c	Sun May 20 01:32:27 2018	(r333908)
@@ -116,7 +116,7 @@ z       - toggle the displaying of the system idle pro
 
 char *next_field(str)
 
-register char *str;
+char *str;
 
 {
     if ((str = strchr(str, ' ')) == NULL)
@@ -138,8 +138,8 @@ char *str;
 int  *intp;
 
 {
-    register int val = 0;
-    register char ch;
+    int val = 0;
+    char ch;
 
     /* if there is nothing left of the string, flag it as an error */
     /* This fix is dedicated to Greg Earle */
@@ -214,10 +214,10 @@ static char *err_listem = 
 char *err_string()
 
 {
-    register struct errs *errp;
-    register int  cnt = 0;
-    register int  first = Yes;
-    register int  currerr = -1;
+    struct errs *errp;
+    int  cnt = 0;
+    int  first = Yes;
+    int  currerr = -1;
     int stringlen;		/* characters still available in "string" */
     static char string[STRMAX];
 
@@ -279,8 +279,8 @@ int len;
 int err;
 
 {
-    register char *msg;
-    register int  msglen;
+    char *msg;
+    int  msglen;
 
     msg = err == 0 ? "Not a number" : errmsg(err);
     msglen = strlen(msg) + 2;
@@ -308,7 +308,7 @@ char *arg;
 int  first;
 
 {
-    register int arglen;
+    int arglen;
 
     arglen = strlen(arg);
     if (!first)
@@ -335,10 +335,10 @@ int  first;
 int
 err_compar(p1, p2)
 
-register struct errs *p1, *p2;
+struct errs *p1, *p2;
 
 {
-    register int result;
+    int result;
 
     if ((result = p1->errnum - p2->errnum) == 0)
     {
@@ -366,8 +366,8 @@ void
 show_errors()
 
 {
-    register int cnt = 0;
-    register struct errs *errp = errs;
+    int cnt = 0;
+    struct errs *errp = errs;
 
     printf("%d error%s:\n\n", errcnt, errcnt == 1 ? "" : "s");
     while (cnt++ < errcnt)
@@ -388,7 +388,7 @@ char *kill_procs(str)
 char *str;
 
 {
-    register char *nptr;
+    char *nptr;
     int signum = SIGTERM;	/* default */
     int procnum;
     struct sigdesc *sigp;
@@ -478,7 +478,7 @@ char *renice_procs(str)
 char *str;
 
 {
-    register char negate;
+    char negate;
     int prio;
     int procnum;
     int uid;

Modified: head/usr.bin/top/display.c
==============================================================================
--- head/usr.bin/top/display.c	Sun May 20 01:30:19 2018	(r333907)
+++ head/usr.bin/top/display.c	Sun May 20 01:32:27 2018	(r333908)
@@ -126,7 +126,7 @@ int  Header_lines =	7;
 int display_resize()
 
 {
-    register int lines;
+    int lines;
 
     /* first, deallocate any previous buffer that may have been there */
     if (screenbuf != NULL)
@@ -167,9 +167,9 @@ int display_updatecpus(statics)
 struct statics *statics;
 
 {
-    register int *lp;
-    register int lines;
-    register int i;
+    int *lp;
+    int lines;
+    int i;
     
     /* call resize to do the dirty work */
     lines = display_resize();
@@ -199,10 +199,10 @@ int display_init(statics)
 struct statics *statics;
 
 {
-    register int lines;
-    register char **pp;
-    register int *ip;
-    register int i;
+    int lines;
+    char **pp;
+    int *ip;
+    int i;
 
     lines = display_updatecpus(statics);
 
@@ -255,7 +255,7 @@ int mpid;
 double *avenrun;
 
 {
-    register int i;
+    int i;
 
     /* i_loadave also clears the screen, since it is first */
     top_clear();
@@ -284,7 +284,7 @@ int mpid;
 double *avenrun;
 
 {
-    register int i;
+    int i;
 
     if (mpid != -1)
     {
@@ -370,7 +370,7 @@ int total;
 int *brkdn;
 
 {
-    register int i;
+    int i;
 
     /* write current number of processes and remember the value */
     printf("%d processes:", total);
@@ -399,7 +399,7 @@ int *brkdn;
 
 {
     static char new[MAX_COLS];
-    register int i;
+    int i;
 
     /* update number of processes only if it has changed */
     if (ltotal != total)
@@ -452,7 +452,7 @@ int *brkdn;
 char *cpustates_tag()
 
 {
-    register char *use;
+    char *use;
 
     static char *short_tag = "CPU: ";
     static char *long_tag = "CPU states: ";
@@ -480,10 +480,10 @@ i_cpustates(states)
 int *states;
 
 {
-    register int i = 0;
-    register int value;
-    register char **names;
-    register char *thisname;
+    int i = 0;
+    int value;
+    char **names;
+    char *thisname;
     int cpu;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
@@ -526,11 +526,11 @@ u_cpustates(states)
 int *states;
 
 {
-    register int value;
-    register char **names;
-    register char *thisname;
-    register int *lp;
-    register int *colp;
+    int value;
+    char **names;
+    char *thisname;
+    int *lp;
+    int *colp;
     int cpu;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
@@ -577,10 +577,10 @@ void
 z_cpustates()
 
 {
-    register int i = 0;
-    register char **names;
-    register char *thisname;
-    register int *lp;
+    int i = 0;
+    char **names;
+    char *thisname;
+    int *lp;
     int cpu, value;
 
 for (cpu = 0; cpu < num_cpus; cpu++) {
@@ -907,8 +907,8 @@ int line;
 char *thisline;
 
 {
-    register char *p;
-    register char *base;
+    char *p;
+    char *base;
 
     /* make sure we are on the correct line */
     while (lastline < y_procs + line)
@@ -938,9 +938,9 @@ int line;
 char *newline;
 
 {
-    register char *optr;
-    register int screen_line = line + Header_lines;
-    register char *bufferline;
+    char *optr;
+    int screen_line = line + Header_lines;
+    char *bufferline;
 
     /* remember a pointer to the current line in the screen buffer */
     bufferline = &screenbuf[lineindex(line)];
@@ -985,8 +985,8 @@ u_endscreen(hi)
 int hi;
 
 {
-    register int screen_line = hi + Header_lines;
-    register int i;
+    int screen_line = hi + Header_lines;
+    int i;
 
     if (smart_terminal)
     {
@@ -1065,7 +1065,7 @@ char *msgfmt;
 caddr_t a1, a2, a3;
 
 {
-    register int i;
+    int i;
 
     /* first, format the message */
     (void) snprintf(next_msg, sizeof(next_msg), msgfmt, a1, a2, a3);
@@ -1116,10 +1116,10 @@ int  size;
 int  numeric;
 
 {
-    register char *ptr = buffer;
-    register char ch;
-    register char cnt = 0;
-    register char maxcnt = 0;
+    char *ptr = buffer;
+    char ch;
+    char cnt = 0;
+    char maxcnt = 0;
 
     /* allow room for null terminator */
     size -= 1;
@@ -1198,10 +1198,10 @@ int  numeric;
 
 static int string_count(pp)
 
-register char **pp;
+char **pp;
 
 {
-    register int cnt;
+    int cnt;
 
     cnt = 0;
     while (*pp++ != NULL)
@@ -1215,12 +1215,12 @@ static void summary_format(str, numbers, names)
 
 char *str;
 int *numbers;
-register char **names;
+char **names;
 
 {
-    register char *p;
-    register int num;
-    register char *thisname;
+    char *p;
+    int num;
+    char *thisname;
     char rbuf[6];
 
     /* format each number followed by its string */
@@ -1274,16 +1274,16 @@ register char **names;
 
 static void line_update(old, new, start, line)
 
-register char *old;
-register char *new;
+char *old;
+char *new;
 int start;
 int line;
 
 {
-    register int ch;
-    register int diff;
-    register int newcol = start + 1;
-    register int lastcol = start;
+    int ch;
+    int diff;
+    int newcol = start + 1;
+    int lastcol = start;
     char cursor_on_line = No;
     char *current;
 
@@ -1404,8 +1404,8 @@ char *printable(str)
 char *str;
 
 {
-    register char *ptr;
-    register char ch;
+    char *ptr;
+    char ch;
 
     ptr = str;
     while ((ch = *ptr) != '\0')

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c	Sun May 20 01:30:19 2018	(r333907)
+++ head/usr.bin/top/top.c	Sun May 20 01:32:27 2018	(r333908)
@@ -245,9 +245,9 @@ int  argc;
 char *argv[];
 
 {
-    register int i;
-    register int active_procs;
-    register int change;
+    int i;
+    int active_procs;
+    int change;
 
     struct system_info system_info;
     struct statics statics;

Modified: head/usr.bin/top/username.c
==============================================================================
--- head/usr.bin/top/username.c	Sun May 20 01:30:19 2018	(r333907)
+++ head/usr.bin/top/username.c	Sun May 20 01:32:27 2018	(r333908)
@@ -76,7 +76,7 @@ char *username(uid)
 int uid;
 
 {
-    register int hashindex;
+    int hashindex;
 
     hashindex = hashit(uid);
     if (is_empty_hash(hashindex) || (hash_table[hashindex].uid != uid))
@@ -117,7 +117,7 @@ char *name;
 int wecare;		/* 1 = enter it always, 0 = nice to have */
 
 {
-    register int hashindex;
+    int hashindex;
 
 #ifdef DEBUG
     fprintf(stderr, "enter_hash(%d, %s, %d)\n", uid, name, wecare);

Modified: head/usr.bin/top/utils.c
==============================================================================
--- head/usr.bin/top/utils.c	Sun May 20 01:30:19 2018	(r333907)
+++ head/usr.bin/top/utils.c	Sun May 20 01:32:27 2018	(r333908)
@@ -26,7 +26,7 @@ int atoiwi(str)
 char *str;
 
 {
-    register int len;
+    int len;
 
     len = strlen(str);
     if (len != 0)
@@ -65,10 +65,10 @@ _Static_assert(sizeof(int) <= 4, "buffer too small for
 
 char *itoa(val)
 
-register int val;
+int val;
 
 {
-    register char *ptr;
+    char *ptr;
     static char buffer[16];	/* result is built here */
     				/* 16 is sufficient since the largest number
 				   we will ever convert will be 2^32-1,
@@ -96,10 +96,10 @@ register int val;
 
 char *itoa7(val)
 
-register int val;
+int val;
 
 {
-    register char *ptr;
+    char *ptr;
     static char buffer[16];	/* result is built here */
     				/* 16 is sufficient since the largest number
 				   we will ever convert will be 2^32-1,
@@ -133,7 +133,7 @@ int digits(val)
 int val;
 
 {
-    register int cnt = 0;
+    int cnt = 0;
 
     while (val > 0)
     {
@@ -150,8 +150,8 @@ int val;
 
 char *strecpy(to, from)
 
-register char *to;
-register char *from;
+char *to;
+char *from;
 
 {
     while ((*to++ = *from++) != '\0');
@@ -168,7 +168,7 @@ char *string;
 char **array;
 
 {
-    register int i = 0;
+    int i = 0;
 
     while (*array != NULL)
     {
@@ -195,13 +195,13 @@ char *line;
 int *cntp;
 
 {
-    register char *from;
-    register char *to;
-    register int cnt;
-    register int ch;
+    char *from;
+    char *to;
+    int cnt;
+    int ch;
     int length;
     int lastch;
-    register char **argv;
+    char **argv;
     char **argarray;
     char *args;
 
@@ -278,15 +278,15 @@ long percentages(cnt, out, new, old, diffs)
 
 int cnt;
 int *out;
-register long *new;
-register long *old;
+long *new;
+long *old;
 long *diffs;
 
 {
-    register int i;
-    register long change;
-    register long total_change;
-    register long *dp;
+    int i;
+    long change;
+    long total_change;
+    long *dp;
     long half_total;
 
     /* initialization */
@@ -375,9 +375,9 @@ char *format_time(seconds)
 long seconds;
 
 {
-    register int value;
-    register int digit;
-    register char *ptr;
+    int value;
+    int digit;
+    char *ptr;
     static char result[10];
 
     /* sanity protection */
@@ -438,9 +438,9 @@ int amt;
 {
     static char retarray[NUM_STRINGS][16];
     static int index = 0;
-    register char *p;
-    register char *ret;
-    register char tag = 'K';
+    char *p;
+    char *ret;
+    char tag = 'K';
 
     p = ret = retarray[index];
     index = (index + 1) % NUM_STRINGS;
@@ -470,9 +470,9 @@ unsigned long long amt;
 {
     static char retarray[NUM_STRINGS][16];
     static int index = 0;
-    register char *p;
-    register char *ret;
-    register char tag = 'K';
+    char *p;
+    char *ret;
+    char tag = 'K';
 
     p = ret = retarray[index];
     index = (index + 1) % NUM_STRINGS;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805200132.w4K1WSQB081461>