diff options
author | Max Kellermann <max@duempel.org> | 2010-02-14 20:36:31 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-02-17 07:22:44 +0100 |
commit | 5e0117b4441f257fcb1aab48b42a787567ebcbe6 (patch) | |
tree | 7233b273814def640145276f1a46d45b8cf274e4 /src/replay_gain_info.c | |
parent | c05e6a1275621421eb0a7c3112b0401fa458841e (diff) | |
download | mpd-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/replay_gain_info.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/replay_gain_info.c b/src/replay_gain_info.c index 33e29e8e3..76bd98acd 100644 --- a/src/replay_gain_info.c +++ b/src/replay_gain_info.c @@ -20,33 +20,6 @@ #include "config.h" #include "replay_gain_info.h" -#include <glib.h> - -struct replay_gain_info * -replay_gain_info_new(void) -{ - struct replay_gain_info *ret = g_new(struct replay_gain_info, 1); - - for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) { - ret->tuples[i].gain = INFINITY; - ret->tuples[i].peak = 0.0; - } - - return ret; -} - -struct replay_gain_info * -replay_gain_info_dup(const struct replay_gain_info *src) -{ - return g_memdup(src, sizeof(*src)); -} - -void -replay_gain_info_free(struct replay_gain_info *info) -{ - g_free(info); -} - float replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp) { |