osc+notify: strcmp() -> streq()

This commit is contained in:
Daniel Eklöf 2024-07-24 16:04:14 +02:00
parent f56da385fe
commit a6bc9cafaf
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 13 additions and 13 deletions

View file

@ -220,7 +220,7 @@ notify_notify(struct terminal *term, struct notification *notif)
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
const struct notification_icon *icon = &term->notification_icons[i];
if (icon->id != NULL && strcmp(icon->id, notif->icon_id) == 0) {
if (icon->id != NULL && streq(icon->id, notif->icon_id)) {
icon_name_or_path = icon->symbolic_name != NULL
? icon->symbolic_name
: icon->tmp_file_name;
@ -378,7 +378,7 @@ notify_icon_add(struct terminal *term, const char *id,
#if defined(_DEBUG)
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
struct notification_icon *icon = &term->notification_icons[i];
if (icon->id != NULL && strcmp(icon->id, id) == 0) {
if (icon->id != NULL && streq(icon->id, id)) {
BUG("notification icon cache already contains \"%s\"", id);
}
}
@ -410,7 +410,7 @@ notify_icon_del(struct terminal *term, const char *id)
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
struct notification_icon *icon = &term->notification_icons[i];
if (icon->id == NULL || strcmp(icon->id, id) != 0)
if (icon->id == NULL || !streq(icon->id, id))
continue;
LOG_DBG("expelled %s from the notification icon cache", icon->id);

20
osc.c
View file

@ -625,9 +625,9 @@ kitty_notification(struct terminal *term, char *string)
if (reverse)
v++;
if (strcmp(v, "focus") == 0)
if (streq(v, "focus"))
focus = !reverse;
else if (strcmp(v, "report") == 0)
else if (streq(v, "report"))
report = !reverse;
}
@ -658,13 +658,13 @@ kitty_notification(struct terminal *term, char *string)
case 'p':
/* payload content: title|body */
if (strcmp(value, "title") == 0)
if (streq(value, "title"))
payload_type = PAYLOAD_TITLE;
else if (strcmp(value, "body") == 0)
else if (streq(value, "body"))
payload_type = PAYLOAD_BODY;
else if (strcmp(value, "icon") == 0)
else if (streq(value, "icon"))
payload_type = PAYLOAD_ICON;
else if (strcmp(value, "?") == 0) {
else if (streq(value, "?")) {
/* Query capabilities */
char when_str[64];
@ -688,11 +688,11 @@ kitty_notification(struct terminal *term, char *string)
case 'o':
/* honor when: always|unfocused|invisible */
have_o = true;
if (strcmp(value, "always") == 0)
if (streq(value, "always"))
when = NOTIFY_ALWAYS;
else if (strcmp(value, "unfocused") == 0)
else if (streq(value, "unfocused"))
when = NOTIFY_UNFOCUSED;
else if (strcmp(value, "invisible") == 0)
else if (streq(value, "invisible"))
when = NOTIFY_INVISIBLE;
break;
@ -733,7 +733,7 @@ kitty_notification(struct terminal *term, char *string)
/* Search for an existing (d=0) notification to update */
struct notification *notif = NULL;
tll_foreach(term->kitty_notifications, it) {
if (strcmp(it->item.id, id) == 0) {
if (streq(it->item.id, id)) {
/* Found existing notification */
notif = &it->item;
break;