diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-04-11 12:47:45 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-04-11 12:47:45 +0200 |
| commit | 0341d038cae51415b30381e59b174070c547b05c (patch) | |
| tree | 8f8ce06da1d1f96a102534ed3b0659d1a24de4db /vis.c | |
| parent | 3b7757793a46beac6e9c31ebce595cd3c41bac77 (diff) | |
| download | vis-0341d038cae51415b30381e59b174070c547b05c.tar.gz vis-0341d038cae51415b30381e59b174070c547b05c.tar.xz | |
Eliminate global running variable
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -38,9 +38,7 @@ #include "util.h" #include "map.h" - /** global variables */ -static volatile bool running = true; /* exit main loop once this becomes false */ static Editor *vis; /* global editor instance, keeps track of all windows etc. */ /** operators */ @@ -945,7 +943,7 @@ static void prompt_enter(const Arg *arg) { * on vis->win. */ switchmode_to(vis->mode_before_prompt); - if (s && *s && exec_command(vis->prompt_type, s) && running) + if (s && *s && exec_command(vis->prompt_type, s) && vis->running) switchmode(&(const Arg){ .i = VIS_MODE_NORMAL }); free(s); editor_draw(vis); @@ -981,7 +979,7 @@ static void insert_verbatim(const Arg *arg) { } static void quit(const Arg *arg) { - running = false; + vis->running = false; } static void cmd(const Arg *arg) { @@ -1910,8 +1908,9 @@ static void mainloop() { sigaddset(&blockset, SIGWINCH); sigprocmask(SIG_BLOCK, &blockset, NULL); editor_draw(vis); + vis->running = true; - while (running) { + while (vis->running) { fd_set fds; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); |
