Module Name: src Committed By: mrg Date: Sun Sep 16 20:39:04 UTC 2018
Modified Files: src/sys/kern: init_sysctl.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.216 -r1.217 src/sys/kern/init_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.216 src/sys/kern/init_sysctl.c:1.217 --- src/sys/kern/init_sysctl.c:1.216 Mon Sep 3 16:29:35 2018 +++ src/sys/kern/init_sysctl.c Sun Sep 16 20:39:04 2018 @@ -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 /* debug0, */ /* debug1, 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 @@ SYSCTL_SETUP(sysctl_debug_setup, "sysctl */ - 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;