aboutsummaryrefslogtreecommitdiff
path: root/sio.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 /sio.c
parent56b9322a73bd3e4f9974b80fdc64bcb863913073 (diff)
simplify fft, switch to assert by malloc
Diffstat (limited to 'sio.c')
-rw-r--r--sio.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sio.c b/sio.c
index ab5b5e8..1f24ffe 100644
--- a/sio.c
+++ b/sio.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 <sndio.h>
@@ -39,11 +40,9 @@ init_sio(unsigned int round)
size_t bufsz;
sio = malloc(sizeof(struct sio));
- if (!sio)
- errx(1, "malloc failed");
+ assert(sio);
sio->sio = sio_open(SIO_DEVANY, SIO_REC, 0);
-
if (!sio->sio)
errx(1, "cannot connect to sound server, is it running?");
@@ -73,9 +72,7 @@ init_sio(unsigned int round)
bufsz += sio->par.round;
sio->bufsz = bufsz * sio->par.rchan * sizeof(int16_t);
sio->buffer = malloc(sio->bufsz);
-
- if (!sio->buffer)
- errx(1, "malloc failed");
+ assert(sio->buffer);
sio_start(sio->sio);