Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Do not recycle loop variable for unrealated purposes.



details:   https://anonhg.NetBSD.org/src/rev/7da11fc1e999
branches:  trunk
changeset: 936046:7da11fc1e999
user:      uwe <uwe%NetBSD.org@localhost>
date:      Fri Jul 17 02:05:44 2020 +0000

description:
Do not recycle loop variable for unrealated purposes.

It just obfuscates the code.  Same object code is generated.

diffstat:

 sys/dev/cninit.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r ae022122fe0c -r 7da11fc1e999 sys/dev/cninit.c
--- a/sys/dev/cninit.c  Thu Jul 16 21:34:52 2020 +0000
+++ b/sys/dev/cninit.c  Fri Jul 17 02:05:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cninit.c,v 1.11 2011/02/08 20:20:26 rmind Exp $        */
+/*     $NetBSD: cninit.c,v 1.12 2020/07/17 02:05:44 uwe Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.11 2011/02/08 20:20:26 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.12 2020/07/17 02:05:44 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -71,18 +71,20 @@
                        bestMatch = cp;
                }
        }
+
        /*
         * No console, we can handle it
         */
-       if ((cp = bestMatch) == NULL)
+       if (bestMatch == NULL)
                return;
+
        /*
         * Turn on console
         */
        {
                struct consdev *old_cn_tab = cn_tab;
 
-               (*cp->cn_init)(cp);
+               (*bestMatch->cn_init)(bestMatch);
                /*
                 * Now let everyone know we have an active console they can
                 * use for diagnostics. If we use cn_tab in the search loop



Home | Main Index | Thread Index | Old Index