From 5e0117b4441f257fcb1aab48b42a787567ebcbe6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 14 Feb 2010 20:36:31 +0100 Subject: 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. --- src/decoder/_flac_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/decoder/_flac_common.c') 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, -- cgit v1.2.3