diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-02-19 21:28:23 +0000 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-02-19 21:28:23 +0000 |
commit | 3109e16ace9cc24ca4bc779d7eacaa6ee6f1200c (patch) | |
tree | 2f428824b773fb020ef3231cc74bf4229fed5bd1 | |
parent | 88b377303f964c92e3be7077d14cf4db70436c5d (diff) |
Move SIGWINCH setup in the display file
The SIGWINCH signal handler calls a display function. For this
we exported the handler in powerdebug.c.
That does not make sense, let's move the signal setup in display.c
directly.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r-- | display.c | 3 | ||||
-rw-r--r-- | powerdebug.c | 5 |
2 files changed, 3 insertions, 5 deletions
@@ -20,6 +20,7 @@ */ #include <stdio.h> +#include <signal.h> #include <string.h> #define _GNU_SOURCE #include <strings.h> @@ -558,6 +559,8 @@ int display_init(struct powerdebug_options *options) current_win = 1 << (ffs(options->flags & DEFAULT_OPTION) - 1); + signal(SIGWINCH, sigwinch_handler); + if (mainloop_add(0, display_keystroke, NULL)) return -1; diff --git a/powerdebug.c b/powerdebug.c index 356a8db..164126d 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -26,13 +26,10 @@ #include <stdio.h> #include <errno.h> #include <ncurses.h> -#include <signal.h> #include "display.h" #include "mainloop.h" #include "powerdebug.h" -extern void sigwinch_handler(int); - void usage(void) { printf("Usage: powerdebug [OPTIONS]\n"); @@ -184,8 +181,6 @@ static struct powerdebug_options *powerdebug_init(void) { struct powerdebug_options *options; - signal(SIGWINCH, sigwinch_handler); - options = malloc(sizeof(*options)); if (!options) return NULL; |