From 759bc8007b2834bdfa7497f8d34ae2e30dd8064b Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sun, 14 Nov 2021 15:08:47 +0000 Subject: 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 --- user-notification.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'user-notification.h') 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 #include #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); -- cgit v1.3