popup - simplify buffer alloc for popup body and silence warning

@fix
This commit is contained in:
Carsten Haitzler 2022-05-18 12:57:24 +01:00
parent 7c6adbd6fe
commit d869db87ce
1 changed files with 11 additions and 9 deletions

View File

@ -63,8 +63,9 @@ _notification_popup_merge(E_Notification_Notify *n)
len = strlen(popup->notif->body);
len += strlen(n->body);
len += 5; /* \xE2\x80\xA9 or <PS/> */
if (len < 8192) body_final = alloca(len + 1);
else body_final = malloc(len + 1);
body_final = malloc(len + 1);
if (body_final)
{
/* Hack to allow e to include markup */
snprintf(body_final, len + 1, "%s<ps/>%s", popup->notif->body, n->body);
@ -74,7 +75,8 @@ _notification_popup_merge(E_Notification_Notify *n)
e_object_del(E_OBJECT(popup->notif));
popup->notif = n;
if (len >= 8192) free(body_final);
free(body_final);
}
return popup;
}