Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb Re-indent, and factor out strlen() now that we have ...



details:   https://anonhg.NetBSD.org/src/rev/c7735b10f728
branches:  trunk
changeset: 773609:c7735b10f728
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 09 17:07:07 2012 +0000

description:
Re-indent, and factor out strlen() now that we have more space.
No functional change.

diffstat:

 sys/ddb/db_sym.c |  30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

diffs (72 lines):

diff -r 352a99cc3135 -r c7735b10f728 sys/ddb/db_sym.c
--- a/sys/ddb/db_sym.c  Thu Feb 09 16:28:53 2012 +0000
+++ b/sys/ddb/db_sym.c  Thu Feb 09 17:07:07 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $     */
+/*     $NetBSD: db_sym.c,v 1.63 2012/02/09 17:07:07 christos Exp $     */
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.63 2012/02/09 17:07:07 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddbparam.h"
@@ -322,23 +322,20 @@
 
                cursym = db_search_symbol(off, strategy, &d);
                db_symbol_values(cursym, &name, &value);
-               if (name != NULL &&
-                   ((unsigned int) d < db_maxoff) &&
+               if (name != NULL && ((unsigned int)d < db_maxoff) &&
                    value != 0) {
                        strlcpy(buf, name, buflen);
                        if (d) {
                                strlcat(buf, "+", buflen);
-                               db_format_radix(buf+strlen(buf),
-                                   24, d, true);
+                               db_format_radix(buf + strlen(buf), 24, d, true);
                        }
                        if (strategy == DB_STGY_PROC) {
                                if ((*db_symformat->sym_line_at_pc)
-                                   (NULL, cursym, &filename,
-                                   &linenum, off))
-                                       snprintf(buf + strlen(buf),
-                                           buflen - strlen(buf),
-                                           " [%s:%d]",
-                                           filename, linenum);
+                                   (NULL, cursym, &filename, &linenum, off)) {
+                                       size_t len = strlen(buf);
+                                       snprintf(buf + len, buflen - len,
+                                           " [%s:%d]", filename, linenum);
+                               }
                        }
                        return;
                }
@@ -397,8 +394,7 @@
 
                cursym = db_search_symbol(off, strategy, &d);
                db_symbol_values(cursym, &name, &value);
-               if (name != NULL &&
-                   ((unsigned int) d < db_maxoff) &&
+               if (name != NULL && ((unsigned int)d < db_maxoff) &&
                    value != 0) {
                        (*pr)("%s", name);
                        if (d) {
@@ -409,10 +405,8 @@
                        }
                        if (strategy == DB_STGY_PROC) {
                                if ((*db_symformat->sym_line_at_pc)
-                                   (NULL, cursym, &filename,
-                                   &linenum, off))
-                                       (*pr)(" [%s:%d]",
-                                           filename, linenum);
+                                   (NULL, cursym, &filename, &linenum, off))
+                                       (*pr)(" [%s:%d]", filename, linenum);
                        }
                        return;
                }



Home | Main Index | Thread Index | Old Index