From 346631cd75138df053cf79192841d9777a6b89c4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 10 Mar 2016 13:03:56 +1000 Subject: [PATCH] Skip the manual NULL assignment after unref libratbag guarantees that unref() always returns NULL Signed-off-by: Peter Hutterer --- src/ratbagd-button.c | 5 +---- src/ratbagd-profile.c | 5 +---- src/ratbagd-resolution.c | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/ratbagd-button.c b/src/ratbagd-button.c index 6561f4ae..b4060d73 100644 --- a/src/ratbagd-button.c +++ b/src/ratbagd-button.c @@ -557,10 +557,7 @@ struct ratbagd_button *ratbagd_button_free(struct ratbagd_button *button) return NULL; button->path = mfree(button->path); - - /* we cannot assume the button is gone, so set NULL explicitly */ - ratbag_button_unref(button->lib_button); - button->lib_button = NULL; + button->lib_button = ratbag_button_unref(button->lib_button); return mfree(button); } diff --git a/src/ratbagd-profile.c b/src/ratbagd-profile.c index 880fda81..fc93ede4 100644 --- a/src/ratbagd-profile.c +++ b/src/ratbagd-profile.c @@ -381,10 +381,7 @@ struct ratbagd_profile *ratbagd_profile_free(struct ratbagd_profile *profile) mfree(profile->resolutions); profile->path = mfree(profile->path); - - /* we cannot assume the profile is gone, so set NULL explicitly */ - ratbag_profile_unref(profile->lib_profile); - profile->lib_profile = NULL; + profile->lib_profile = ratbag_profile_unref(profile->lib_profile); return mfree(profile); } diff --git a/src/ratbagd-resolution.c b/src/ratbagd-resolution.c index 45472421..cecadabe 100644 --- a/src/ratbagd-resolution.c +++ b/src/ratbagd-resolution.c @@ -166,10 +166,7 @@ struct ratbagd_resolution *ratbagd_resolution_free(struct ratbagd_resolution *re return NULL; resolution->path = mfree(resolution->path); - - /* we cannot assume the resolution is gone, so set NULL explicitly */ - ratbag_resolution_unref(resolution->lib_resolution); - resolution->lib_resolution = NULL; + resolution->lib_resolution = ratbag_resolution_unref(resolution->lib_resolution); return mfree(resolution); }