aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/_flac_common.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-02-14 20:36:31 +0100
committerMax Kellermann <max@duempel.org>2010-02-17 07:22:44 +0100
commit5e0117b4441f257fcb1aab48b42a787567ebcbe6 (patch)
tree7233b273814def640145276f1a46d45b8cf274e4 /src/decoder/_flac_common.c
parentc05e6a1275621421eb0a7c3112b0401fa458841e (diff)
downloadmpd-5e0117b4441f257fcb1aab48b42a787567ebcbe6.tar.gz
mpd-5e0117b4441f257fcb1aab48b42a787567ebcbe6.tar.xz
mpd-5e0117b4441f257fcb1aab48b42a787567ebcbe6.zip
replay_gain_info: allocate the struct statically
Don't allocate each replay_gain_info object on the heap. Those objects who held a pointer now store a full replay_gain_info object. This reduces the number of allocations and heap fragmentation.
Diffstat (limited to '')
-rw-r--r--src/decoder/_flac_common.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index 6e28792ec..b642121ba 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -116,7 +116,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
if (data->unsupported)
return;
- struct replay_gain_info *rgi;
+ struct replay_gain_info rgi;
switch (block->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
@@ -124,11 +124,8 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
break;
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
- rgi = flac_parse_replay_gain(block);
- if (rgi != NULL) {
- decoder_replay_gain(data->decoder, rgi);
- replay_gain_info_free(rgi);
- }
+ if (flac_parse_replay_gain(&rgi, block))
+ decoder_replay_gain(data->decoder, &rgi);
if (data->tag != NULL)
flac_vorbis_comments_to_tag(data->tag, NULL,