diff options
| author | Craig Barnes <craigbarnes@protonmail.com> | 2021-11-14 15:08:47 +0000 |
|---|---|---|
| committer | Craig Barnes <craigbarnes@protonmail.com> | 2021-11-14 15:16:32 +0000 |
| commit | 759bc8007b2834bdfa7497f8d34ae2e30dd8064b (patch) | |
| tree | c5313deb8e2c6e072983731394bacd541873638f /user-notification.h | |
| parent | config: remove options that were deprecated in 1.8.x (diff) | |
user-notification: config: various small cleanups
* Rename user_notification_add() to user_notification_add_fmt()
* Add new user_notification_add() helper function
* Use xvasprintf() to replace user_notification_add_va()
* Make better use of helper functions in config.c
Diffstat (limited to 'user-notification.h')
| -rw-r--r-- | user-notification.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/user-notification.h b/user-notification.h index 507c1791..df2390c7 100644 --- a/user-notification.h +++ b/user-notification.h @@ -1,6 +1,5 @@ #pragma once -#include <stdbool.h> #include <tllist.h> #include "macros.h" @@ -26,6 +25,17 @@ user_notifications_free(user_notifications_t *notifications) tll_free(*notifications); } -bool user_notification_add(user_notifications_t *notifications, +static inline void +user_notification_add(user_notifications_t *notifications, + enum user_notification_kind kind, char *text) +{ + struct user_notification notification = { + .kind = kind, + .text = text + }; + tll_push_back(*notifications, notification); +} + +void user_notification_add_fmt(user_notifications_t *notifications, enum user_notification_kind kind, const char *fmt, ...) PRINTF(3); |
