Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump - use PT_STRINGS



details:   https://anonhg.NetBSD.org/src/rev/76420983c79d
branches:  trunk
changeset: 769192:76420983c79d
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 02 20:11:42 2011 +0000

description:
- use PT_STRINGS
- use __arraycount()

diffstat:

 usr.bin/kdump/kdump.c |  18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diffs (49 lines):

diff -r 41c34fc27abf -r 76420983c79d usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Fri Sep 02 20:10:19 2011 +0000
+++ b/usr.bin/kdump/kdump.c     Fri Sep 02 20:11:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.112 2011/06/01 21:28:32 alnsn Exp $        */
+/*     $NetBSD: kdump.c,v 1.113 2011/09/02 20:11:42 christos Exp $     */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.112 2011/06/01 21:28:32 alnsn Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.113 2011/09/02 20:11:42 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,10 +81,7 @@
 #define small(v)       (((long)(v) >= 0) && ((long)(v) < 10))
 
 static const char * const ptrace_ops[] = {
-       "PT_TRACE_ME",  "PT_READ_I",    "PT_READ_D",    "PT_READ_U",
-       "PT_WRITE_I",   "PT_WRITE_D",   "PT_WRITE_U",   "PT_CONTINUE",
-       "PT_KILL",      "PT_ATTACH",    "PT_DETACH",    "PT_IO",
-       "PT_DUMPCORE",  "PT_LWPINFO",   "PT_SYSCALL",
+       PT_STRINGS
 };
 
 #ifdef PT_MACHDEP_STRINGS
@@ -574,14 +571,13 @@
                                else
                                        output_long((long)*ap, 1);
                        } else {
-                               if ((long)*ap >= 0 && *ap <
-                                   (register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0])))
+                               if ((long)*ap >= 0 && *ap < (register_t)
+                                   __arraycount(ptrace_ops))
                                        (void)printf("%s", ptrace_ops[*ap]);
 #ifdef PT_MACHDEP_STRINGS
                                else if (*ap >= PT_FIRSTMACH &&
-                                   *ap - PT_FIRSTMACH <
-                                   (register_t)(sizeof(ptrace_machdep_ops) /
-                                               sizeof(ptrace_machdep_ops[0])))
+                                   *ap - PT_FIRSTMACH < (register_t)
+                                   __arraycount(ptrace_machdep_ops))
                                        (void)printf("%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
 #endif
                                else



Home | Main Index | Thread Index | Old Index