diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-01 03:50:14 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-01 03:50:14 +0200 |
commit | 7b105f7622bf9df1898d8d2005ea3d3ee4f7038c (patch) | |
tree | bbfd0c2707f9001f2731ea5024ea7b0316a844eb /src | |
parent | 7206b492d8f026daabcf168082fcd55480b3d652 (diff) |
make the malloc functions less verbose
Diffstat (limited to 'src')
-rw-r--r-- | src/mixer.c | 5 | ||||
-rw-r--r-- | src/pcm.c | 6 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/mixer.c b/src/mixer.c index 5b07f15..56e2293 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -244,10 +244,7 @@ struct _snd_mixer_selem_id { int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr) { - if (!(*ptr = calloc(1, sizeof(**ptr)))) - return -1; - - return 0; + return ((*ptr = calloc(1, sizeof(**ptr))) ? 0 : -1); } void @@ -600,8 +600,7 @@ int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr) { // OpenAL-soft uses this :( - *ptr = calloc(1, sizeof(**ptr)); - return (*ptr ? 0 : -1); + return ((*ptr = calloc(1, sizeof(**ptr))) ? 0 : -1); } void @@ -920,8 +919,7 @@ int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr) { // OpenAL-soft uses this :( - *ptr = calloc(1, sizeof(**ptr)); - return (*ptr ? 0 : -1); + return ((*ptr = calloc(1, sizeof(**ptr))) ? 0 : -1); } void |