diff --git a/src/notification.c b/src/notification.c index 1cea286..9e5dd9a 100644 --- a/src/notification.c +++ b/src/notification.c @@ -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) diff --git a/src/notification.h b/src/notification.h index a866214..fa1de64 100644 --- a/src/notification.h +++ b/src/notification.h @@ -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);