[PATCH 3/4] [EVAL] Take advantage of EV_EXIT in evalstring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jilles Tjoelker <jilles@xxxxxxxx>
Date: Sat, 13 Jun 2009 16:17:45 -0500

Check if there may be additional data in the string after parsing each
command.  If there is none, let the EV_EXIT flag take effect so a fork
can be omitted in specific cases.

No change in behavior intended --- all current callers leave the
EV_EXIT flag cleared.

[jn: the original from FreeBSD SVN r194128 would unconditionally exit
 if the EV_EXIT bit was set. but for simplicity and consistency with
 other non-evaltree eval* commands, this version relies on the caller
 to exit when the command is empty.  One can insert a

	evaltree(NULL, flags);

 call before popfile() to get the original's semantics.

 Any outstanding bugs are my fault.]

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 src/eval.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index 5c26133..77a9d00 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -165,7 +165,10 @@ evalstring(char *s, int flags)
 
 	status = 0;
 	while ((n = parsecmd(0)) != NEOF) {
-		evaltree(n, flags);
+		if (preadateof())
+			evaltree(n, flags);
+		else
+			evaltree(n, flags & ~EV_EXIT);
 		status = exitstatus;
 		popstackmark(&smark);
 		if (evalskip)
-- 
1.7.5.rc0

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux