Author: jhb
Date: Wed Aug 19 19:59:42 2015
New Revision: 286937
URL: https://svnweb.freebsd.org/changeset/base/286937

Log:
  Use nitems().

Modified:
  head/usr.bin/truss/amd64-fbsd.c
  head/usr.bin/truss/amd64-fbsd32.c
  head/usr.bin/truss/amd64-linux32.c
  head/usr.bin/truss/arm-fbsd.c
  head/usr.bin/truss/i386-fbsd.c
  head/usr.bin/truss/i386-linux.c
  head/usr.bin/truss/mips-fbsd.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/powerpc64-fbsd.c
  head/usr.bin/truss/sparc64-fbsd.c

Modified: head/usr.bin/truss/amd64-fbsd.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd.c     Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/amd64-fbsd.c     Wed Aug 19 19:59:42 2015        
(r286937)
@@ -64,7 +64,7 @@ static const char rcsid[] =
 
 #include "syscalls.h"
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/amd64-fbsd32.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd32.c   Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/amd64-fbsd32.c   Wed Aug 19 19:59:42 2015        
(r286937)
@@ -64,8 +64,7 @@ static const char rcsid[] =
 
 #include "freebsd32_syscalls.h"
 
-static int nsyscalls = sizeof(freebsd32_syscallnames) /
-    sizeof(freebsd32_syscallnames[0]);
+static int nsyscalls = nitems(freebsd32_syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/amd64-linux32.c
==============================================================================
--- head/usr.bin/truss/amd64-linux32.c  Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/amd64-linux32.c  Wed Aug 19 19:59:42 2015        
(r286937)
@@ -61,8 +61,7 @@ static const char rcsid[] =
 
 #include "linux32_syscalls.h"
 
-static int nsyscalls =
-       sizeof(linux32_syscallnames) / sizeof(linux32_syscallnames[0]);
+static int nsyscalls = nitems(linux32_syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.
@@ -310,8 +309,7 @@ amd64_linux32_syscall_exit(struct trussi
         * but that complicates things considerably.
         */
        if (errorp) {
-               for (i = 0;
-                   (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++) {
+               for (i = 0; (size_t)i < nitems(bsd_to_linux_errno); i++) {
                        if (retval == bsd_to_linux_errno[i])
                                break;
                }

Modified: head/usr.bin/truss/arm-fbsd.c
==============================================================================
--- head/usr.bin/truss/arm-fbsd.c       Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/arm-fbsd.c       Wed Aug 19 19:59:42 2015        
(r286937)
@@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$");
 #include "syscalls.h"
 
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/i386-fbsd.c
==============================================================================
--- head/usr.bin/truss/i386-fbsd.c      Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/i386-fbsd.c      Wed Aug 19 19:59:42 2015        
(r286937)
@@ -64,7 +64,7 @@ static const char rcsid[] =
 
 #include "syscalls.h"
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/i386-linux.c
==============================================================================
--- head/usr.bin/truss/i386-linux.c     Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/i386-linux.c     Wed Aug 19 19:59:42 2015        
(r286937)
@@ -61,8 +61,7 @@ static const char rcsid[] =
 
 #include "linux_syscalls.h"
 
-static int nsyscalls =
-       sizeof(linux_syscallnames) / sizeof(linux_syscallnames[0]);
+static int nsyscalls = nitems(linux_syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.
@@ -309,8 +308,7 @@ i386_linux_syscall_exit(struct trussinfo
         * but that complicates things considerably.
         */
        if (errorp) {
-               for (i = 0;
-                   (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++) {
+               for (i = 0; (size_t)i < nitems(bsd_to_linux_errno); i++) {
                        if (retval == bsd_to_linux_errno[i])
                                break;
                }

Modified: head/usr.bin/truss/mips-fbsd.c
==============================================================================
--- head/usr.bin/truss/mips-fbsd.c      Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/mips-fbsd.c      Wed Aug 19 19:59:42 2015        
(r286937)
@@ -68,7 +68,7 @@ static const char rcsid[] =
 
 #include "syscalls.h"
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/powerpc-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc-fbsd.c   Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/powerpc-fbsd.c   Wed Aug 19 19:59:42 2015        
(r286937)
@@ -68,7 +68,7 @@ static const char rcsid[] =
 #include "syscalls.h"
 #endif
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/powerpc64-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc64-fbsd.c Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/powerpc64-fbsd.c Wed Aug 19 19:59:42 2015        
(r286937)
@@ -63,7 +63,7 @@ static const char rcsid[] =
 
 #include "syscalls.h"
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.

Modified: head/usr.bin/truss/sparc64-fbsd.c
==============================================================================
--- head/usr.bin/truss/sparc64-fbsd.c   Wed Aug 19 18:33:25 2015        
(r286936)
+++ head/usr.bin/truss/sparc64-fbsd.c   Wed Aug 19 19:59:42 2015        
(r286937)
@@ -69,7 +69,7 @@ static const char rcsid[] =
 
 #include "syscalls.h"
 
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
+static int nsyscalls = nitems(syscallnames);
 
 /*
  * This is what this particular file uses to keep track of a system call.
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to