summary refs log tree commit diff
path: root/src/bltin
diff options
context:
space:
mode:
authorOleg Verych <olecom@flower.upol.cz>2007-09-22 21:19:37 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-09-22 21:37:35 +0800
commit0c85b4576ed590dcd21a93470c49d57ded8414a9 (patch)
tree4394281207ebb65ca1502a968bcacf5a99097984 /src/bltin
parent[BUILTIN] test: White space fixes (diff)
downloaddash-0c85b4576ed590dcd21a93470c49d57ded8414a9.tar.gz
dash-0c85b4576ed590dcd21a93470c49d57ded8414a9.zip
[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$
Diffstat (limited to 'src/bltin')
-rw-r--r--src/bltin/test.c4
1 files changed, 2 insertions, 2 deletions
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;
 	}