summaryrefslogtreecommitdiffstats
path: root/bin/sh/eval.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-11-23 22:17:39 +0000
committerjilles <jilles@FreeBSD.org>2010-11-23 22:17:39 +0000
commit7377de8f916e2389e9f1c47ca8f7de558aaca6ef (patch)
treeff9e8102b66741a601dc54d4455bad759b583a8b /bin/sh/eval.c
parent77837b201a907898ee7c79f6a8584102187a089a (diff)
downloadFreeBSD-src-7377de8f916e2389e9f1c47ca8f7de558aaca6ef.zip
FreeBSD-src-7377de8f916e2389e9f1c47ca8f7de558aaca6ef.tar.gz
sh: Code size optimizations to "stack string" memory allocation:
* Prefer one CHECKSTRSPACE with multiple USTPUTC to multiple STPUTC. * Add STPUTS macro (based on function) and use it instead of loops that add nul-terminated strings to the stack string. No functional change is intended, but code size is about 1K less on i386.
Diffstat (limited to 'bin/sh/eval.c')
-rw-r--r--bin/sh/eval.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index c306e73..5bae2f2 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -135,8 +135,7 @@ evalcmd(int argc, char **argv)
STARTSTACKSTR(concat);
ap = argv + 2;
for (;;) {
- while (*p)
- STPUTC(*p++, concat);
+ STPUTS(p, concat);
if ((p = *ap++) == NULL)
break;
STPUTC(' ', concat);
OpenPOWER on IntegriCloud