aboutsummaryrefslogtreecommitdiffstats
path: root/src/replay_gain_info.h
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/replay_gain_info.h
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 'src/replay_gain_info.h')
-rw-r--r--src/replay_gain_info.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/replay_gain_info.h b/src/replay_gain_info.h
index 2465a250e..c61bac387 100644
--- a/src/replay_gain_info.h
+++ b/src/replay_gain_info.h
@@ -40,17 +40,19 @@ struct replay_gain_info {
struct replay_gain_tuple tuples[2];
};
-struct replay_gain_info *
-replay_gain_info_new(void);
-
-/**
- * Duplicate a #replay_gain_info object.
- */
-struct replay_gain_info *
-replay_gain_info_dup(const struct replay_gain_info *src);
+static inline void
+replay_gain_tuple_init(struct replay_gain_tuple *tuple)
+{
+ tuple->gain = INFINITY;
+ tuple->peak = 0.0;
+}
-void
-replay_gain_info_free(struct replay_gain_info *info);
+static inline void
+replay_gain_info_init(struct replay_gain_info *info)
+{
+ replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_ALBUM]);
+ replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_TRACK]);
+}
static inline bool
replay_gain_tuple_defined(const struct replay_gain_tuple *tuple)