aboutsummaryrefslogtreecommitdiff
path: root/alsa.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-02 18:11:30 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-02 18:11:30 +0000
commite5400522430da40e678270f50a2c9eaa12fb8c1b (patch)
tree687e26c8c104a4d92aadf408ac0a47dd6e6045ba /alsa.c
parent56b9322a73bd3e4f9974b80fdc64bcb863913073 (diff)
simplify fft, switch to assert by malloc
Diffstat (limited to 'alsa.c')
-rw-r--r--alsa.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/alsa.c b/alsa.c
index bc307ed..9511f4a 100644
--- a/alsa.c
+++ b/alsa.c
@@ -15,6 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <assert.h>
#include <err.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
@@ -38,8 +39,7 @@ init_sio(unsigned int round)
sio = malloc(sizeof(struct sio));
- if (!sio)
- errx(1, "malloc failed");
+ assert(sio);
rc = snd_pcm_open(&sio->handle, "default", SND_PCM_STREAM_CAPTURE, 0);
if (rc < 0)
@@ -63,9 +63,7 @@ init_sio(unsigned int round)
sio->bufsz = sio->frames * RCHAN * sizeof(int16_t);
sio->buffer = malloc(sio->bufsz);
-
- if (!sio->buffer)
- errx(1, "malloc failed");
+ assert(sio->buffer);
return sio;
}