diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-05-07 17:52:27 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-05-07 17:52:27 +0200 |
commit | 6954f21fd48b99a57130e25183f46776e97dbc28 (patch) | |
tree | 524c0a993e4273bdab59cb786526b62581dfb4db /src | |
parent | Fix #174: Use nanosleep() instead of usleep() (diff) | |
download | redshift-ng-6954f21fd48b99a57130e25183f46776e97dbc28.tar.gz redshift-ng-6954f21fd48b99a57130e25183f46776e97dbc28.tar.bz2 redshift-ng-6954f21fd48b99a57130e25183f46776e97dbc28.tar.xz |
remove unnecessary null-checks, it is safe to pass NULL to free (per documentation)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gamma-drm.c | 3 | ||||
-rw-r--r-- | src/location-geoclue.c | 4 | ||||
-rw-r--r-- | src/redshift.c | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/gamma-drm.c b/src/gamma-drm.c index d431395..d15f3f6 100644 --- a/src/gamma-drm.c +++ b/src/gamma-drm.c @@ -190,8 +190,7 @@ drm_free(drm_state_t *state) if (state->crtcs != NULL) { drm_crtc_state_t *crtcs = state->crtcs; while (crtcs->crtc_num >= 0) { - if (crtcs->r_gamma != NULL) - free(crtcs->r_gamma); + free(crtcs->r_gamma); crtcs->crtc_num = -1; crtcs++; } diff --git a/src/location-geoclue.c b/src/location-geoclue.c index b2616bf..851a75b 100644 --- a/src/location-geoclue.c +++ b/src/location-geoclue.c @@ -123,8 +123,8 @@ void location_geoclue_free(location_geoclue_state_t *state) { if (state->position != NULL) g_object_unref(state->position); - if (state->provider != NULL) free(state->provider); - if (state->provider_path != NULL) free(state->provider_path); + free(state->provider); + free(state->provider_path); } void diff --git a/src/redshift.c b/src/redshift.c index 0fcb0ba..095e0db 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -1096,7 +1096,7 @@ main(int argc, char *argv[]) &scheme.night.brightness); break; case 'c': - if (config_filepath != NULL) free(config_filepath); + free(config_filepath); config_filepath = strdup(optarg); break; case 'g': @@ -1245,7 +1245,7 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if (config_filepath != NULL) free(config_filepath); + free(config_filepath); /* Read global config settings. */ config_ini_section_t *section = config_ini_get_section(&config_state, |