diff options
author | Max Kellermann <max@duempel.org> | 2008-09-12 16:41:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-12 16:41:20 +0200 |
commit | 265b8fffb270325f62a15a842fe4498c87a08204 (patch) | |
tree | c1ba0da95d684c354a6284b1180a8b62f2d107c8 /src/audioOutputs/audioOutput_shout_ogg.c | |
parent | ebd194998aa6f140a0889a9d51fb356f76639361 (diff) | |
download | mpd-265b8fffb270325f62a15a842fe4498c87a08204.tar.gz mpd-265b8fffb270325f62a15a842fe4498c87a08204.tar.xz mpd-265b8fffb270325f62a15a842fe4498c87a08204.zip |
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".
Diffstat (limited to 'src/audioOutputs/audioOutput_shout_ogg.c')
-rw-r--r-- | src/audioOutputs/audioOutput_shout_ogg.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |