From 92e83a939f08820e8e99674463641bf89695e5a9 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Mon, 20 Feb 2017 17:25:59 +0200 Subject: [PATCH] Remove a few more leftover memory allocation checks According to the glib memory allocation documentation, if any memory allocation calls fail the application will be terminated so there is no need to check if the call succeeded. --- src/option_parser.c | 1 - src/x.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/option_parser.c b/src/option_parser.c index 8bcaee2..3edb398 100644 --- a/src/option_parser.c +++ b/src/option_parser.c @@ -49,7 +49,6 @@ section_t *new_section(char *name) section_count++; sections = g_realloc(sections, sizeof(section_t) * section_count); - if(sections == NULL) die("Unable to allocate memory.\n", 1); sections[section_count - 1].name = g_strdup(name); sections[section_count - 1].entries = NULL; sections[section_count - 1].entry_count = 0; diff --git a/src/x.c b/src/x.c index 62dbce7..310c341 100644 --- a/src/x.c +++ b/src/x.c @@ -1378,9 +1378,6 @@ void x_shortcut_init(keyboard_shortcut * ks) char *str = g_strdup(ks->str); char *str_begin = str; - if (str == NULL) - die("Unable to allocate memory", EXIT_FAILURE); - while (strchr(str, '+')) { char *mod = str; while (*str != '+')