From 265b8fffb270325f62a15a842fe4498c87a08204 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Sep 2008 16:41:20 +0200 Subject: shout: make the shout_buffer static Since the buffer size is known at compile time, we can save an indirection by declaring it as a char array instead of a pointer. That saves an extra allocation, and we can calculate with the compile-time constant sizeof(data) instead of the attribute "max_len". --- src/audioOutputs/audioOutput_shout_ogg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/audioOutputs/audioOutput_shout_ogg.c') diff --git a/src/audioOutputs/audioOutput_shout_ogg.c b/src/audioOutputs/audioOutput_shout_ogg.c index 746341a75..9605f9737 100644 --- a/src/audioOutputs/audioOutput_shout_ogg.c +++ b/src/audioOutputs/audioOutput_shout_ogg.c @@ -75,7 +75,7 @@ static void copy_tag_to_vorbis_comment(struct shout_data *sd) static int copy_ogg_buffer_to_shout_buffer(ogg_page *og, struct shout_buffer *buf) { - if (buf->max_len - buf->len >= (size_t)og->header_len) { + if (sizeof(buf->data) - buf->len >= (size_t)og->header_len) { memcpy(buf->data + buf->len, og->header, og->header_len); buf->len += og->header_len; @@ -84,7 +84,7 @@ static int copy_ogg_buffer_to_shout_buffer(ogg_page *og, return -1; } - if (buf->max_len - buf->len >= (size_t)og->body_len) { + if (sizeof(buf->data) - buf->len >= (size_t)og->body_len) { memcpy(buf->data + buf->len, og->body, og->body_len); buf->len += og->body_len; -- cgit v1.2.3