aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-28 20:43:15 +0100
committerMax Kellermann <max@duempel.org>2008-10-28 20:43:15 +0100
commit28b47725ffed5aa1ecb7812abda65d84275cb50d (patch)
tree9558d50600347d3d9f2d95b8bd69466e122b50be /src
parent56ebdf1cd1f201f0c8fc5dc8623c8305700ce97d (diff)
downloadmpd-28b47725ffed5aa1ecb7812abda65d84275cb50d.tar.gz
mpd-28b47725ffed5aa1ecb7812abda65d84275cb50d.tar.xz
mpd-28b47725ffed5aa1ecb7812abda65d84275cb50d.zip
mp3: use GLib allocation functions
This removes the need for util.h.
Diffstat (limited to '')
-rw-r--r--src/decoder/mp3_plugin.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index 88015636a..ee1d9f2bd 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -18,9 +18,11 @@
#include "../decoder_api.h"
#include "../log.h"
-#include "../utils.h"
#include "../conf.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
#include <glib.h>
#include <mad.h>
@@ -263,10 +265,7 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
id3_data = data->stream.this_frame;
mad_stream_skip(&(data->stream), tagsize);
} else {
- allocated = xmalloc(tagsize);
- if (!allocated)
- goto fail;
-
+ allocated = g_malloc(tagsize);
memcpy(allocated, data->stream.this_frame, count);
mad_stream_skip(&(data->stream), count);
@@ -313,8 +312,7 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
id3_tag_delete(id3_tag);
fail:
- if (allocated)
- free(allocated);
+ g_free(allocated);
}
#endif
@@ -732,8 +730,8 @@ mp3_decode_first_frame(struct mp3_data *data, struct tag **tag,
return false;
}
- data->frame_offsets = xmalloc(sizeof(long) * data->max_frames);
- data->times = xmalloc(sizeof(mad_timer_t) * data->max_frames);
+ data->frame_offsets = g_malloc(sizeof(long) * data->max_frames);
+ data->times = g_malloc(sizeof(mad_timer_t) * data->max_frames);
return true;
}
@@ -744,8 +742,8 @@ static void mp3_data_finish(struct mp3_data *data)
mad_frame_finish(&data->frame);
mad_stream_finish(&data->stream);
- if (data->frame_offsets) free(data->frame_offsets);
- if (data->times) free(data->times);
+ g_free(data->frame_offsets);
+ g_free(data->times);
}
/* this is primarily used for getting total time for tags */