From 44a94779a85f2a87cd0d552c1d272b8c05b85630 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sun, 11 Nov 2007 15:00:06 +0800 Subject: [EXPAND] Removed herefd hack The herefd hack goes back more than a decade. it limits the amount of memory we have to allocate when expanding here-documents by writing the result out from time to time. However, it's no longer safe because the stack is used to place intermediate results too and there we certainly don't want to write them out should we be short on memory. In any case, with today's computers we can afford to keep the entire result in memory and write them out at the end. --- src/expand.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/expand.c') diff --git a/src/expand.c b/src/expand.c index c489446..ee699e8 100644 --- a/src/expand.c +++ b/src/expand.c @@ -184,7 +184,6 @@ static inline const char *getpwhome(const char *name) void expandhere(union node *arg, int fd) { - herefd = fd; expandarg(arg, (struct arglist *)NULL, EXP_QUOTED); xwrite(fd, stackblock(), expdest - (char *)stackblock()); } @@ -663,18 +662,15 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla int quotes = flag & QUOTES_ESC; char *startp; char *loc; - int saveherefd = herefd; struct nodelist *saveargbackq = argbackq; int amount; char *rmesc, *rmescend; int zero; char *(*scan)(char *, char *, char *, char *, int , int); - herefd = -1; argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? (flag & EXP_QUOTED ? EXP_QPAT : EXP_CASE) : 0)); STPUTC('\0', expdest); - herefd = saveherefd; argbackq = saveargbackq; startp = stackblock() + startloc; -- cgit 1.4.1