diff options
author | Max Kellermann <max@duempel.org> | 2009-03-26 19:43:15 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-26 19:43:15 +0100 |
commit | 7475ded935a00d790d4e97ecf55f4fb3306d80fb (patch) | |
tree | 1186d74f4bd8d652fa8983c83508a4924af3832a /src/mixer | |
parent | 66a2c5669e1fcd709a00bd4de8ddfb0d3a0c2a58 (diff) | |
download | mpd-7475ded935a00d790d4e97ecf55f4fb3306d80fb.tar.gz mpd-7475ded935a00d790d4e97ecf55f4fb3306d80fb.tar.xz mpd-7475ded935a00d790d4e97ecf55f4fb3306d80fb.zip |
mixer_control: don't allow mixer==NULL
As a side effect, the previous patch added the mixer==NULL checks. It
is now illegal to call mixer functions with a NULL argument. Convert
the runtime checks to assertions.
Diffstat (limited to '')
-rw-r--r-- | src/mixer_control.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mixer_control.c b/src/mixer_control.c index d3f246800..f1d67a078 100644 --- a/src/mixer_control.c +++ b/src/mixer_control.c @@ -58,9 +58,7 @@ mixer_new(const struct mixer_plugin *plugin, const struct config_param *param) void mixer_free(struct mixer *mixer) { - if (!mixer) { - return; - } + assert(mixer != NULL); assert(mixer->plugin != NULL); assert(mixer->mutex != NULL); @@ -74,9 +72,7 @@ mixer_open(struct mixer *mixer) { bool success; - if (!mixer) { - return false; - } + assert(mixer != NULL); assert(mixer->plugin != NULL); g_mutex_lock(mixer->mutex); @@ -89,9 +85,7 @@ mixer_open(struct mixer *mixer) void mixer_close(struct mixer *mixer) { - if (!mixer) { - return; - } + assert(mixer != NULL); assert(mixer->plugin != NULL); g_mutex_lock(mixer->mutex); @@ -104,6 +98,8 @@ mixer_get_volume(struct mixer *mixer) { int volume; + assert(mixer != NULL); + g_mutex_lock(mixer->mutex); volume = mixer->plugin->get_volume(mixer); g_mutex_unlock(mixer->mutex); @@ -116,6 +112,8 @@ mixer_set_volume(struct mixer *mixer, unsigned volume) { bool success; + assert(mixer != NULL); + g_mutex_lock(mixer->mutex); success = mixer->plugin->set_volume(mixer, volume); g_mutex_unlock(mixer->mutex); |