From 7110734b6e1defdd880d171ee92fd089d6c5a08f Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Fri, 6 Oct 2017 14:53:04 +0200 Subject: [PATCH] Move queue initialization to queues.c --- src/dunst.c | 5 +---- src/queues.c | 7 +++++++ src/queues.h | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/dunst.c b/src/dunst.c index b1d9696..ef6df80 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -240,10 +240,7 @@ static void teardown(void) int dunst_main(int argc, char *argv[]) { - /*TODO: move to queues.c */ - history = g_queue_new(); - displayed = g_queue_new(); - queue = g_queue_new(); + queues_init(); cmdline_load(argc, argv); diff --git a/src/queues.c b/src/queues.c index 163f7d2..e1f1a26 100644 --- a/src/queues.c +++ b/src/queues.c @@ -14,6 +14,13 @@ GQueue *queue = NULL; /* all new notifications get into here */ GQueue *displayed = NULL; /* currently displayed notifications */ GQueue *history = NULL; /* history of displayed notifications */ +void queues_init(void) +{ + history = g_queue_new(); + displayed = g_queue_new(); + queue = g_queue_new(); +} + bool notification_replace_by_id(notification *new) { diff --git a/src/queues.h b/src/queues.h index 70e031f..6440e5d 100644 --- a/src/queues.h +++ b/src/queues.h @@ -9,6 +9,11 @@ extern GQueue *queue; extern GQueue *displayed; extern GQueue *history; +/* + * Initialise neccessary queues + */ +void queues_init(void); + /* * Replace the notification which matches the id field of * the new notification. The given notification is inserted