Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/systat Rename 'cur' to 'name' to avoid aliasing a gl...



details:   https://anonhg.NetBSD.org/src/rev/311115083b5d
branches:  trunk
changeset: 588021:311115083b5d
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Feb 05 08:51:03 2006 +0000

description:
Rename 'cur' to 'name' to avoid aliasing a global - this code has some
horrid globals...

diffstat:

 usr.bin/systat/globalcmds.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (68 lines):

diff -r de772f6c0d39 -r 311115083b5d usr.bin/systat/globalcmds.c
--- a/usr.bin/systat/globalcmds.c       Sun Feb 05 06:47:48 2006 +0000
+++ b/usr.bin/systat/globalcmds.c       Sun Feb 05 08:51:03 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: globalcmds.c,v 1.12 2005/02/26 19:01:09 dsl Exp $ */
+/*     $NetBSD: globalcmds.c,v 1.13 2006/02/05 08:51:03 dsl Exp $ */
 
 /*-
  * Copyright (c) 1999
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: globalcmds.c,v 1.12 2005/02/26 19:01:09 dsl Exp $");
+__RCSID("$NetBSD: globalcmds.c,v 1.13 2006/02/05 08:51:03 dsl Exp $");
 #endif /* not lint */
 
 #include <curses.h>
@@ -79,28 +79,28 @@
 {
        int col, len;
        struct mode *p;
-       char *cur, *prev;
+       char *name, *prev;
 
        move(CMDLINE, col = 0);
-       cur = prev = NULL;
+       name = prev = NULL;
        for (p = modes; p->c_name; p++) {
-               if ((cur = shortname(args, p->c_name)) == NULL)
+               if ((name = shortname(args, p->c_name)) == NULL)
                        continue;
-               if (cur && prev && strcmp(cur, prev) == 0) {
-                       free(cur);
-                       cur = NULL;
+               if (name && prev && strcmp(name, prev) == 0) {
+                       free(name);
+                       name = NULL;
                        continue;
                }
-               len = strlen(cur);
+               len = strlen(name);
                if (col + len > COLS)
                        break;
-               addstr(cur); col += len;
+               addstr(name); col += len;
                if (col + 1 < COLS)
                        addch(' ');
                if (prev)
                        free(prev);
-               prev = cur;
-               cur = NULL;
+               prev = name;
+               name = NULL;
        }
        if (col == 0 && args) {
                standout();
@@ -111,8 +111,8 @@
                standend();
        }
        clrtoeol();
-       if (cur)
-               free(cur);
+       if (name)
+               free(name);
        if (prev)
                free(prev);
 }



Home | Main Index | Thread Index | Old Index