new function: die(...)
This commit is contained in:
parent
1b4b7c3ae2
commit
03411ac365
12
dunst.c
12
dunst.c
@ -137,6 +137,12 @@ void print_version(void);
|
||||
void init_shortcut(keyboard_shortcut * shortcut);
|
||||
KeySym string_to_mask(char *str);
|
||||
|
||||
void die(char *text, int exit_value)
|
||||
{
|
||||
fputs(text, stderr);
|
||||
exit(exit_value);
|
||||
}
|
||||
|
||||
int cmp_notification(void *a, void *b)
|
||||
{
|
||||
if (a == NULL && b == NULL)
|
||||
@ -842,10 +848,8 @@ void init_shortcut(keyboard_shortcut * ks)
|
||||
char *str = strdup(ks->str);
|
||||
char *str_begin = str;
|
||||
|
||||
if (str == NULL) {
|
||||
fprintf(stderr, "Unable to allocate memory");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (str == NULL)
|
||||
die("Unable to allocate memory", EXIT_FAILURE);
|
||||
|
||||
while (strstr(str, "+")) {
|
||||
char *mod = str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user