diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-10-02 20:26:08 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-10-02 20:26:08 +0000 |
commit | 18301dfca56ba8545549e80f84423d83a46c6b64 (patch) | |
tree | 28854229666a3054a2985cd040d504e860e0623b /src/bbuffer.c | |
parent | 0ec595d89d9e1c10cd3f8a3d8dd3a1235c6f5fda (diff) |
a lot of minor cleanups
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@36 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'src/bbuffer.c')
-rw-r--r-- | src/bbuffer.c | 14 |
1 files changed, 9 insertions, 5 deletions
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 <config.h> +#endif + #include <sys/types.h> #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]) { |