aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-23 06:05:19 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-23 06:05:19 +0000
commite52d6e3fb8648c34e9e859db03ce3c0ad50ca952 (patch)
tree81c20fab55bcace3ce97847325f086bffda6e5ff /osc.c
parentpgo: update notify_notify() prototype, add notify_free() (diff)
osc: kitty notifications: use xstrjoin() instead of xasprintf()
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/osc.c b/osc.c
index 6926c3ca..ef54f520 100644
--- a/osc.c
+++ b/osc.c
@@ -722,8 +722,6 @@ kitty_notification(struct terminal *term, char *string)
}
if (notif == NULL) {
- /* Somewhat unoptimized... this will be free:d and removed
- immediately if d=1 */
tll_push_front(term->notifications, ((struct notification){
.id = id,
.icon = NULL,
@@ -766,18 +764,18 @@ kitty_notification(struct terminal *term, char *string)
notif->title = payload;
payload = NULL;
} else {
- char *new_title = xasprintf("%s%s", notif->title, payload);
- free(notif->title);
- notif->title = new_title;
+ char *old_title = notif->title;
+ notif->title = xstrjoin(old_title, payload);
+ free(old_title);
}
} else {
if (notif->body == NULL) {
notif->body = payload;
payload = NULL;
} else {
- char *new_body = xasprintf("%s%s", notif->body, payload);
- free(notif->body);
- notif->body = new_body;
+ char *old_body = notif->body;
+ notif->body = xstrjoin(old_body, payload);
+ free(old_body);
}
}