Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2015 20:19:01 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284462 - head/sys/kern
Message-ID:  <201506162019.t5GKJ1Vi076201@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Jun 16 20:19:00 2015
New Revision: 284462
URL: https://svnweb.freebsd.org/changeset/base/284462

Log:
  Use nitems() macro instead of __arraycount()

Modified:
  head/sys/kern/stack_protector.c

Modified: head/sys/kern/stack_protector.c
==============================================================================
--- head/sys/kern/stack_protector.c	Tue Jun 16 20:01:01 2015	(r284461)
+++ head/sys/kern/stack_protector.c	Tue Jun 16 20:19:00 2015	(r284462)
@@ -17,15 +17,14 @@ __stack_chk_fail(void)
 	panic("stack overflow detected; backtrace may be corrupted");
 }
 
-#define __arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
 static void
 __stack_chk_init(void *dummy __unused)
 {
 	size_t i;
-	long guard[__arraycount(__stack_chk_guard)];
+	long guard[nitems(__stack_chk_guard)];
 
 	arc4rand(guard, sizeof(guard), 0);
-	for (i = 0; i < __arraycount(guard); i++)
+	for (i = 0; i < nitems(guard); i++)
 		__stack_chk_guard[i] = guard[i];
 }
 SYSINIT(stack_chk, SI_SUB_RANDOM, SI_ORDER_ANY, __stack_chk_init, NULL);



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