summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-10-15 07:31:15 (GMT)
committer Mike Frysinger <vapier@gentoo.org>2009-10-15 07:33:31 (GMT)
commitccb1959aa519f45967e7600c6eb11f70211364df (patch)
treefd3cea3ed7c6b790ef1452a9bae6f82d8787d31c
parentdb67a20595be279e7db9f5f8e27bd94534efb8d4 (diff)
downloadbusybox-ccb1959aa519f45967e7600c6eb11f70211364df.tar.gz
busybox-ccb1959aa519f45967e7600c6eb11f70211364df.tar.bz2
hush: unify handling of builtin applets
Saves about 10 bytes for each additional builtin applet. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--shell/hush.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 21f3edc..3a1d6f8 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6897,24 +6897,24 @@ static int FAST_FUNC builtin_true(char **argv UNUSED_PARAM)
return 0;
}
-static int FAST_FUNC builtin_test(char **argv)
+static int FAST_FUNC _builtin_applet(char **argv, int (applet)(int argc, char **argv))
{
int argc = 0;
while (*argv) {
argc++;
argv++;
}
- return test_main(argc, argv - argc);
+ return applet(argc, argv - argc);
+}
+
+static int FAST_FUNC builtin_test(char **argv)
+{
+ return _builtin_applet(argv, test_main);
}
static int FAST_FUNC builtin_echo(char **argv)
{
- int argc = 0;
- while (*argv) {
- argc++;
- argv++;
- }
- return echo_main(argc, argv - argc);
+ return _builtin_applet(argv, echo_main);
}
static int FAST_FUNC builtin_eval(char **argv)