From 18301dfca56ba8545549e80f84423d83a46c6b64 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 2 Oct 2007 20:26:08 +0000 Subject: a lot of minor cleanups git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@36 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce --- src/bbuffer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/bbuffer.c') diff --git a/src/bbuffer.c b/src/bbuffer.c index c8cbaa0..86bc5ee 100644 --- a/src/bbuffer.c +++ b/src/bbuffer.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include "bbuffer.h" @@ -12,7 +16,7 @@ int sa_bbuffer_init(sa_bbuffer_t *b, unsigned nchannels, size_t sample_size) { b->nchannels = nchannels; b->sample_size = sample_size; - + if (!(b->data = sa_new0(void *, nchannels))) { b->size = NULL; return SA_ERROR_OOM; @@ -23,7 +27,7 @@ int sa_bbuffer_init(sa_bbuffer_t *b, unsigned nchannels, size_t sample_size) { b->data = NULL; return SA_ERROR_OOM; } - + return SA_SUCCESS; } @@ -34,7 +38,7 @@ void sa_bbuffer_done(sa_bbuffer_t *b) { if (b->data) { for (i = 0; i < b->nchannels; i++) sa_free(b->data[i]); - + sa_free(b->data); } @@ -50,7 +54,7 @@ void* sa_bbuffer_get(sa_bbuffer_t *b, unsigned channel, size_t size, int interle sa_assert(size > 0); if (interleave) { - + if (!b->data[0] || size * b->nchannels > b->size[0]) { sa_free(b->data[0]); b->size[0] = size * b->nchannels; @@ -60,7 +64,7 @@ void* sa_bbuffer_get(sa_bbuffer_t *b, unsigned channel, size_t size, int interle } return (uint8_t*) b->data[0] + (b->sample_size * channel); - + } else { if (!b->data[channel] || size > b->size[channel]) { -- cgit