diff options
author | Oleg Verych <olecom@flower.upol.cz> | 2007-09-22 21:19:37 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-09-22 21:37:35 +0800 |
commit | 0c85b4576ed590dcd21a93470c49d57ded8414a9 (patch) | |
tree | 4394281207ebb65ca1502a968bcacf5a99097984 | |
parent | [BUILTIN] test: White space fixes (diff) | |
download | dash-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$
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/bltin/test.c | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 5804248..b22197f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2007-09-22 Oleg Verych <olecom@flower.upol.cz> * White space fixes for test(1). + * Use direct comparison instead of strcmp in test(1). 2007-09-22 Herbert Xu <herbert@gondor.apana.org.au> 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; } |