summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2016-05-02 21:48:09 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2016-05-02 21:48:09 -0700
commitbe5dc790c83dd8fa406457dc42f58fa6dddf7885 (patch)
treeb39381900721610f0d843eb1b240d78142039310
parent447c42291c157080a59a2701c9a726963b2706a1 (diff)
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
-rw-r--r--fzy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fzy.c b/fzy.c
index dd8f993..3853b58 100644
--- a/fzy.c
+++ b/fzy.c
@@ -99,8 +99,6 @@ static void emit(choices_t *choices) {
/* No match, output the query instead */
printf("%s\n", search);
}
-
- exit(EXIT_SUCCESS);
}
#define KEY_CTRL(key) ((key) - ('@'))
@@ -152,6 +150,9 @@ static void run(tty_t *tty, choices_t *choices) {
tty_close(tty);
emit(choices);
+
+ /* Return to eventually exit successfully */
+ return;
} else if (ch == KEY_ESC) { /* ESC */
ch = tty_getchar(tty);
if (ch == '[' || ch == 'O') {