Source-Changes-HG archive

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

[src/trunk]: src/sys/kern CTL_DEBUG_MAXID is only used to size a static array...



details:   https://anonhg.NetBSD.org/src/rev/dfd00d72060a
branches:  trunk
changeset: 433488:dfd00d72060a
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Sep 16 20:39:04 2018 +0000

description:
CTL_DEBUG_MAXID is only used to size a static array that the compiler
can do just fine itself.  use the compiler and remove the define.

diffstat:

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

diffs (38 lines):

diff -r fa8ad8d953f6 -r dfd00d72060a sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c    Sun Sep 16 20:21:56 2018 +0000
+++ b/sys/kern/init_sysctl.c    Sun Sep 16 20:39:04 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_sysctl.c,v 1.216 2018/09/03 16:29:35 riastradh Exp $ */
+/*     $NetBSD: init_sysctl.c,v 1.217 2018/09/16 20:39:04 mrg Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.216 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.217 2018/09/16 20:39:04 mrg Exp $");
 
 #include "opt_sysv.h"
 #include "opt_compat_netbsd.h"
@@ -632,9 +632,7 @@
 struct ctldebug debug5, debug6, debug7, debug8, debug9;
 struct ctldebug debug10, debug11, debug12, debug13, debug14;
 struct ctldebug debug15, debug16, debug17, debug18, debug19;
-
-#define        CTL_DEBUG_MAXID         20
-static struct ctldebug *debugvars[CTL_DEBUG_MAXID] = {
+static struct ctldebug *debugvars[] = {
        &debug0, &debug1, &debug2, &debug3, &debug4,
        &debug5, &debug6, &debug7, &debug8, &debug9,
        &debug10, &debug11, &debug12, &debug13, &debug14,
@@ -668,7 +666,7 @@
 
         */
 
-       for (i = 0; i < CTL_DEBUG_MAXID; i++) {
+       for (i = 0; i < __arraycount(debugvars); i++) {
                cdp = debugvars[i];
                if (cdp->debugname == NULL || cdp->debugvar == NULL)
                        continue;



Home | Main Index | Thread Index | Old Index