summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorherbert <herbert@gondor.apana.org.au>2005-02-25 21:48:59 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2005-09-26 18:33:03 +1000
commit0f6e68ff04886875613506f6d6fb3fd88ed1ec25 (patch)
tree2a425ff3fc3b22244cdd547a3dd1cc7ea7a58168 /src
parentCorrected grammar in manual page. (diff)
downloaddash-0f6e68ff04886875613506f6d6fb3fd88ed1ec25.tar.gz
dash-0f6e68ff04886875613506f6d6fb3fd88ed1ec25.zip
Size optimisations with state/s in main().
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 4902cfa..9b5a409 100644
--- a/src/main.c
+++ b/src/main.c
@@ -122,11 +122,13 @@ main(int argc, char **argv)
 	monitor(4, etext, profile_buf, sizeof profile_buf, 50);
 #endif
 	state = 0;
-	if (setjmp(jmploc.loc)) {
+	if (unlikely(setjmp(jmploc.loc))) {
 		int status;
 		int e;
+		int s;
 
 		reset();
+		s = state;
 
 		e = exception;
 		switch (exception) {
@@ -140,7 +142,7 @@ main(int argc, char **argv)
 
 		case EXEXIT:
 		case EXEVAL:
-			state = 0;
+			s = 0;
 			/* fall through */
 		default:
 			status = exitstatus;
@@ -148,7 +150,7 @@ main(int argc, char **argv)
 		}
 		exitstatus = status;
 
-		if (state == 0 || iflag == 0 || shlvl)
+		if (s == 0 || iflag == 0 || shlvl)
 			exitshell();
 
 		if (e == EXINT
@@ -163,11 +165,11 @@ main(int argc, char **argv)
 		}
 		popstackmark(&smark);
 		FORCEINTON;				/* enable interrupts */
-		if (state == 1)
+		if (s == 1)
 			goto state1;
-		else if (state == 2)
+		else if (s == 2)
 			goto state2;
-		else if (state == 3)
+		else if (s == 3)
 			goto state3;
 		else
 			goto state4;
s='nohover-highlight'> 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe This simplifies some things, adds support for line number tag definitions, and should enable combining htagml with other preprocessors in the future. 2021-01-12Split fields by tab onlyJune McEnroe Also don't fail hard on non-forward-search definitions. 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe neovim is laggy as hell in my OpenBSD VM, so I switched to vi so I could type without getting frustrated. 2021-01-09Add c -t flag to print expression typeJune McEnroe Also add missing float case. 2021-01-05Update taglineJune McEnroe