Don't check return status of notification_create

notification_create is guaranteed to return a pointer to a notification,
if the memory allocation fails it throws an error and exits the program.
This commit is contained in:
Nikos Tsipinakis 2017-01-01 17:05:25 +02:00
parent 0a0c02021d
commit 0cb1524cc6
3 changed files with 1 additions and 6 deletions

View File

@ -296,9 +296,6 @@ static void on_notify(GDBusConnection * connection,
}
notification *n = notification_create();
if(n == NULL) {
die("Unable to allocate memory", EXIT_FAILURE);
}
n->appname = appname;
n->summary = summary;
n->body = body;

View File

@ -344,9 +344,6 @@ int dunst_main(int argc, char *argv[])
if (settings.startup_notification) {
notification *n = notification_create();
if(n == NULL) {
die("Unable to allocate memory", EXIT_FAILURE);
}
n->appname = strdup("dunst");
n->summary = strdup("startup");
n->body = strdup("dunst is up and running");

View File

@ -321,6 +321,7 @@ char *notification_extract_markup_urls(char **str_ptr) {
notification *notification_create(void)
{
notification *n = malloc(sizeof(notification));
if(n == NULL) die("Unable to allocate memory", EXIT_FAILURE);
memset(n, 0, sizeof(notification));
return n;
}