Notification comparison done right

This commit is contained in:
Benedikt Heine 2018-07-06 18:10:24 +02:00
parent e4b0aae05a
commit e091dd4d15
2 changed files with 11 additions and 11 deletions

View File

@ -150,17 +150,11 @@ const char *notification_urgency_to_string(enum urgency urgency)
}
/*
* Helper function to compare to given
* Helper function to compare two given
* notifications.
*/
int notification_cmp(const void *va, const void *vb)
int notification_cmp(const notification *a, const notification *b)
{
notification *a = (notification *) va;
notification *b = (notification *) vb;
if (!settings.sort)
return 1;
if (a->urgency != b->urgency) {
return b->urgency - a->urgency;
} else {
@ -174,7 +168,13 @@ int notification_cmp(const void *va, const void *vb)
*/
int notification_cmp_data(const void *va, const void *vb, void *data)
{
return notification_cmp(va, vb);
notification *a = (notification *) va;
notification *b = (notification *) vb;
if (!settings.sort)
return 1;
return notification_cmp(a, b);
}
int notification_is_duplicate(const notification *a, const notification *b)

View File

@ -89,8 +89,8 @@ void notification_init(notification *n);
void actions_free(Actions *a);
void rawimage_free(RawImage *i);
void notification_free(notification *n);
int notification_cmp(const void *a, const void *b);
int notification_cmp_data(const void *a, const void *b, void *data);
int notification_cmp(const notification *a, const notification *b);
int notification_cmp_data(const void *va, const void *vb, void *data);
int notification_is_duplicate(const notification *a, const notification *b);
void notification_run_script(notification *n);
void notification_print(notification *n);