summaryrefslogtreecommitdiffstats
path: root/bin/sh/expand.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-04-25 20:43:19 +0000
committerjilles <jilles@FreeBSD.org>2010-04-25 20:43:19 +0000
commit88403fad183ba6067547daa0d779c87bf100403f (patch)
tree0d483cc468eee9850434c86361d24e23e247d468 /bin/sh/expand.c
parent019a1d16bacaa7783b857c309ce61d655e899904 (diff)
downloadFreeBSD-src-88403fad183ba6067547daa0d779c87bf100403f.zip
FreeBSD-src-88403fad183ba6067547daa0d779c87bf100403f.tar.gz
sh: Use stalloc for arith variable names.
This is simpler than the custom memory tracker I added earlier, and is also needed by the dash arith code I plan to import.
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r--bin/sh/expand.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index ab885ac..7d98737 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -360,7 +360,7 @@ removerecordregions(int endoff)
void
expari(int flag)
{
- char *p, *start;
+ char *p, *q, *start;
arith_t result;
int begoff;
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
@@ -398,7 +398,9 @@ expari(int flag)
removerecordregions(begoff);
if (quotes)
rmescapes(p+2);
+ q = grabstackstr(expdest);
result = arith(p+2);
+ ungrabstackstr(q, expdest);
fmtstr(p, DIGITS(result), ARITH_FORMAT_STR, result);
while (*p++)
;
OpenPOWER on IntegriCloud