From 172a1dbdb9719cd71835d639f15fcac95e549915 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Jul 2009 19:04:38 +0200 Subject: [PATCH] pcm_byteswap: converted NULL checks to assertions It is illegal to pass a NULL buffer to pcm_byteswap_X(). The result of this is that pcm_byteswap_X() never returns NULL. --- src/pcm_byteswap.c | 6 ++---- src/pcm_convert.c | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/pcm_byteswap.c b/src/pcm_byteswap.c index 6bdec1f24..1c1caeeca 100644 --- a/src/pcm_byteswap.c +++ b/src/pcm_byteswap.c @@ -38,8 +38,7 @@ const int16_t *pcm_byteswap_16(struct pcm_buffer *buffer, unsigned i; int16_t *buf = pcm_buffer_get(buffer, len); - if (!buf) - return NULL; + assert(buf != NULL); for (i = 0; i < len / 2; i++) buf[i] = swab16(src[i]); @@ -61,8 +60,7 @@ const int32_t *pcm_byteswap_32(struct pcm_buffer *buffer, unsigned i; int32_t *buf = pcm_buffer_get(buffer, len); - if (!buf) - return NULL; + assert(buf != NULL); for (i = 0; i < len / 4; i++) buf[i] = swab32(src[i]); diff --git a/src/pcm_convert.c b/src/pcm_convert.c index 94c72a941..8a35d807e 100644 --- a/src/pcm_convert.c +++ b/src/pcm_convert.c @@ -88,8 +88,7 @@ pcm_convert_16(struct pcm_convert_state *state, if (dest_format->reverse_endian) { buf = pcm_byteswap_16(&state->byteswap_buffer, buf, len); - if (!buf) - g_error("pcm_byteswap_16() failed"); + assert(buf != NULL); } *dest_size_r = len; @@ -131,8 +130,7 @@ pcm_convert_24(struct pcm_convert_state *state, if (dest_format->reverse_endian) { buf = pcm_byteswap_32(&state->byteswap_buffer, buf, len); - if (!buf) - g_error("pcm_byteswap_32() failed"); + assert(buf != NULL); } *dest_size_r = len; @@ -174,8 +172,7 @@ pcm_convert_32(struct pcm_convert_state *state, if (dest_format->reverse_endian) { buf = pcm_byteswap_32(&state->byteswap_buffer, buf, len); - if (!buf) - g_error("pcm_byteswap_32() failed"); + assert(buf != NULL); } *dest_size_r = len;