From 0c85b4576ed590dcd21a93470c49d57ded8414a9 Mon Sep 17 00:00:00 2001 From: Oleg Verych Date: Sat, 22 Sep 2007 21:19:37 +0800 Subject: [BUILTIN] test: little size and speed optimizations * Speed up (libc=glibc): deen:debian/src/dash-0.5.3# echo $(((7853+8631+7529+9777+9161+7552)/6)) 8417,8250 # this patch deen:/mnt/work/debian/src/dash-0.5.3# echo $(((9553+7789+9450+9925+7595+9590)/6)) 8983 # short deen:debian/src/dash-0.5.3# echo $(( (9655+7853+9733+7826+9618+10053)/6 )) 9123 # '[' ']' deen:debian/src/dash-0.5.3# deen:debian/src/dash-0.5.3# echo $(((9231+9423+9365+9650+8883+8291)/6)) 9140 # unpatched deen:debian/src/dash-0.5.3# * Size down: olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o # this patchset text data bss dec hex filename 4142 0 16 4158 103e src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o text data bss dec hex filename 4209 0 16 4225 1081 src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$ --- src/bltin/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bltin') diff --git a/src/bltin/test.c b/src/bltin/test.c index fd24fae..7d49569 100644 --- a/src/bltin/test.c +++ b/src/bltin/test.c @@ -157,8 +157,8 @@ testcmd(int argc, char **argv) { int res; - if (strcmp(argv[0], "[") == 0) { - if (strcmp(argv[--argc], "]")) + if (*argv[0] == '[') { + if (*argv[--argc] != ']') error("missing ]"); argv[argc] = NULL; } -- cgit 1.4.1