diff options
author | jilles <jilles@FreeBSD.org> | 2010-12-12 00:07:27 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-12-12 00:07:27 +0000 |
commit | 9daf74d4c87761a7e7ef2d664810944cc789fe26 (patch) | |
tree | 66bc541c1c427371757d1d2e2510eb44cbf5cb94 /bin/sh/memalloc.c | |
parent | b173b18025943e9b8fb30f95e8c8ad3161b21b0d (diff) | |
download | FreeBSD-src-9daf74d4c87761a7e7ef2d664810944cc789fe26.zip FreeBSD-src-9daf74d4c87761a7e7ef2d664810944cc789fe26.tar.gz |
sh: Remove the herefd hack.
The herefd hack wrote out partial here documents while expanding them. It
seems unnecessary complication given that other expansions just allocate
memory. It causes bugs because the stack is also used for intermediate
results such as arithmetic expressions. Such places should disable herefd
for the duration but not all of them do, and I prefer removing the need for
disabling herefd to disabling it everywhere needed.
Here documents larger than 1024 bytes will use a bit more CPU time and
memory.
Additionally this allows a later change to expand here documents in the
current shell environment. (This is faster for small here documents but also
changes behaviour.)
Obtained from: dash
Diffstat (limited to 'bin/sh/memalloc.c')
-rw-r--r-- | bin/sh/memalloc.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index d00b4d9..47b5b83 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -128,7 +128,6 @@ static struct stackmark *markp; char *stacknxt; int stacknleft; int sstrnleft; -int herefd = -1; static void @@ -309,11 +308,6 @@ growstackstr(void) int len; len = stackblocksize(); - if (herefd >= 0 && len >= 1024) { - xwrite(herefd, stackblock(), len); - sstrnleft = len; - return stackblock(); - } return growstrstackblock(len); } |