Browse code

Make run returns on success, then exit from main

No real advantage, but I get to feel warm and fuzzy about

HEAP SUMMARY:
in use at exit: 0 bytes in 0 blocks
total heap usage: 8 allocs, 8 frees, 15,425 bytes allocated

John Hawthorn authored on 03/05/2016 04:48:09
Showing 1 changed files

  • fzy.c index dd8f993..3853b58 100644
... ...
@@ -99,8 +99,6 @@ static void emit(choices_t *choices) {
99 99
 		/* No match, output the query instead */
100 100
 		printf("%s\n", search);
101 101
 	}
102
-
103
-	exit(EXIT_SUCCESS);
104 102
 }
105 103
 
106 104
 #define KEY_CTRL(key) ((key) - ('@'))
... ...
@@ -152,6 +150,9 @@ static void run(tty_t *tty, choices_t *choices) {
152 150
 			tty_close(tty);
153 151
 
154 152
 			emit(choices);
153
+
154
+			/* Return to eventually exit successfully */
155
+			return;
155 156
 		} else if (ch == KEY_ESC) { /* ESC */
156 157
 			ch = tty_getchar(tty);
157 158
 			if (ch == '[' || ch == 'O') {