svn commit: trunk/busybox: coreutils scripts

vda at busybox.net vda at busybox.net
Wed Nov 29 14:32:01 UTC 2006


Author: vda
Date: 2006-11-29 06:32:01 -0800 (Wed, 29 Nov 2006)
New Revision: 16720

Log:
od: fix buglet in --traditional, microoptimization,
    document coreutils bug
bloat-o-meter: account for objects in rodata too


Modified:
   trunk/busybox/coreutils/od_bloaty.c
   trunk/busybox/scripts/bloat-o-meter


Changeset:
Modified: trunk/busybox/coreutils/od_bloaty.c
===================================================================
--- trunk/busybox/coreutils/od_bloaty.c	2006-11-29 13:21:28 UTC (rev 16719)
+++ trunk/busybox/coreutils/od_bloaty.c	2006-11-29 14:32:01 UTC (rev 16720)
@@ -845,17 +845,18 @@
 {
 }
 
-static int address_pad_len;
-static char address_fmt[] = "%0*"OFF_FMT"xc";
+static char address_fmt[] = "%0n"OFF_FMT"xc";
 /* Corresponds to 'x' above */
 #define address_base_char address_fmt[sizeof(address_fmt)-3]
+/* Corresponds to 'n' above */
+#define address_pad_len_char address_fmt[2]
 
 static void
 format_address_std(off_t address, char c)
 {
 	/* Corresponds to 'c' */
 	address_fmt[sizeof(address_fmt)-2] = c;
-	printf(address_fmt, address_pad_len, address);
+	printf(address_fmt, address);
 }
 
 #if ENABLE_GETOPT_LONG
@@ -865,6 +866,7 @@
 {
 	putchar('(');
 	format_address_std(address, ')');
+	/* BUG in coreutils 5.2.1! must be "if (c) putchar(c);" */
 	putchar(c);
 }
 
@@ -926,7 +928,7 @@
 			if (i == 0)
 				format_address(current_offset, '\0');
 			else
-				printf("%*s", address_pad_len, "");
+				printf("%*s", address_pad_len_char - '0', "");
 			(*spec[i].print_function) (n_bytes, curr_block, spec[i].fmt_string);
 			if (spec[i].hexl_mode_trailer) {
 				/* space-pad out to full line width, then dump the trailer */
@@ -1261,7 +1263,7 @@
 	spec = NULL;
 	format_address = format_address_std;
 	address_base_char = 'o';
-	address_pad_len = 7;
+	address_pad_len_char = '7';
 	flag_dump_strings = 0;
 
 	/* Parse command line */
@@ -1279,14 +1281,12 @@
 	argv += optind;
 	if (opt & OPT_A) {
 		static const char doxn[] = "doxn";
-		static FN_format_address *const doxn_format_address[] = {
-			format_address_std,
-			format_address_std,
-			format_address_std,
-			format_address_none,
+		static const char doxn_address_base_char[] = {
+			'u', 'o', 'x', /* '?' fourth one is not important */
 		};
-		static const char doxn_address_base_char[] = { 'u', 'o', 'x', 'x' };
-		static const uint8_t doxn_address_pad_len[] = { 7, 7, 6, 0 };
+		static const uint8_t doxn_address_pad_len_char[] = {
+			'7', '7', '6', /* '?' */
+		};
 		char *p;
 		int pos;
 		p = strchr(doxn, str_A[0]);
@@ -1294,9 +1294,9 @@
 			bb_error_msg_and_die("bad output address radix "
 				"'%c' (must be [doxn])", str_A[0]);
 		pos = p - doxn;
-		format_address = doxn_format_address[pos];
+		if (pos == 3) format_address = format_address_none;
 		address_base_char = doxn_address_base_char[pos];
-		address_pad_len = doxn_address_pad_len[pos];
+		address_pad_len_char = doxn_address_pad_len_char[pos];
 	}
 	if (opt & OPT_N) {
 		limit_bytes_to_format = 1;
@@ -1389,12 +1389,12 @@
 		}
 
 		if (flag_pseudo_start) {
-			format_address = format_address_label;
 			if (format_address == format_address_none) {
 				address_base_char = 'o';
-				address_pad_len = 7;
+				address_pad_len_char = '7';
 				format_address = format_address_paren;
-			}
+			} else
+				format_address = format_address_label;
 		}
 	}
 #endif

Modified: trunk/busybox/scripts/bloat-o-meter
===================================================================
--- trunk/busybox/scripts/bloat-o-meter	2006-11-29 13:21:28 UTC (rev 16719)
+++ trunk/busybox/scripts/bloat-o-meter	2006-11-29 14:32:01 UTC (rev 16720)
@@ -17,7 +17,7 @@
     sym = {}
     for l in os.popen("nm --size-sort " + file).readlines():
         size, type, name = l[:-1].split()
-        if type in "tTdDbB":
+        if type in "tTdDbBrR":
             if "." in name: name = "static." + name.split(".")[0]
             sym[name] = sym.get(name, 0) + int(size, 16)
     for l in os.popen("readelf -S " + file).readlines():




More information about the busybox-cvs mailing list