[git commit] hush: renumber PIPE_foo, make PIPE_SEQ = 0

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 8 19:35:53 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=00a06b971531031103c25d650e2078c801afbe39
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

PIPE_SEQ is used most often, having it zero makes code smaller:

function                                             old     new   delta
done_word                                            719     707     -12
parse_stream                                        2546    2531     -15

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/shell/hush.c b/shell/hush.c
index 5a36a76..57252a1 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -588,10 +588,10 @@ struct pipe {
 	IF_HAS_KEYWORDS(smallint res_word;) /* needed for if, for, while, until... */
 };
 typedef enum pipe_style {
-	PIPE_SEQ = 1,
-	PIPE_AND = 2,
-	PIPE_OR  = 3,
-	PIPE_BG  = 4,
+	PIPE_SEQ = 0,
+	PIPE_AND = 1,
+	PIPE_OR  = 2,
+	PIPE_BG  = 3,
 } pipe_style;
 /* Is there anything in this pipe at all? */
 #define IS_NULL_PIPE(pi) \
@@ -3139,7 +3139,6 @@ static struct pipe *new_pipe(void)
 {
 	struct pipe *pi;
 	pi = xzalloc(sizeof(struct pipe));
-	/*pi->followup = 0; - deliberately invalid value */
 	/*pi->res_word = RES_NONE; - RES_NONE is 0 anyway */
 	return pi;
 }


More information about the busybox-cvs mailing list