[git commit master 1/1] pstree: another tiny shrink

Denys Vlasenko vda.linux at googlemail.com
Sun Dec 5 18:36:58 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=2161bd701a9267c04aa68fb43b2d40d7793884d4
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
pstree_main                                          327     324      -3

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 procps/pstree.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/procps/pstree.c b/procps/pstree.c
index 7e12773..54a910f 100644
--- a/procps/pstree.c
+++ b/procps/pstree.c
@@ -61,7 +61,7 @@ typedef struct child {
 #define first_3  "-+-"
 
 struct globals {
-	/* 0-based. IOW: the number of chars we printer on current line */
+	/* 0-based. IOW: the number of chars we printed on current line */
 	unsigned cur_x;
 	unsigned output_width;
 
@@ -95,16 +95,6 @@ static void ensure_buffer_capacity(int bufindex)
 	}
 }
 
-#if ENABLE_FEATURE_CLEAN_UP
-static void maybe_free_buffers(void)
-{
-	free(G.width);
-	free(G.more);
-}
-#else
-# define maybe_free_buffers() ((void)0)
-#endif
-
 /* NB: this function is never called with "bad" chars
  * (control chars or chars >= 0x7f)
  */
@@ -385,12 +375,11 @@ int pstree_main(int argc UNUSED_PARAM, char **argv)
 
 	get_terminal_width_height(1, &G.output_width, NULL);
 
+	opt_complementary = "?1";
 	getopt32(argv, "p");
 	argv += optind;
 
 	if (argv[0]) {
-		if (argv[1])
-			bb_show_usage();
 		if (argv[0][0] >= '0' && argv[0][0] <= '9') {
 			pid = xatoi(argv[0]);
 		} else {
@@ -409,6 +398,9 @@ int pstree_main(int argc UNUSED_PARAM, char **argv)
 		}
 	}
 
-	maybe_free_buffers();
+	if (ENABLE_FEATURE_CLEAN_UP) {
+		free(G.width);
+		free(G.more);
+	}
 	return 0;
 }
-- 
1.7.2.2



More information about the busybox-cvs mailing list