From 27ca0db7a6143d2e479ff1ae52ec7c349ab1d4f2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 7 Jan 2014 23:33:46 +0100 Subject: util/Alloc: new library replacing GLib's g_malloc() --- src/decoder/GmeDecoderPlugin.cxx | 5 +++-- src/decoder/SidplayDecoderPlugin.cxx | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/decoder') diff --git a/src/decoder/GmeDecoderPlugin.cxx b/src/decoder/GmeDecoderPlugin.cxx index 815fd8d69..aafc8f07d 100644 --- a/src/decoder/GmeDecoderPlugin.cxx +++ b/src/decoder/GmeDecoderPlugin.cxx @@ -22,6 +22,7 @@ #include "DecoderAPI.hxx" #include "CheckAudioFormat.hxx" #include "tag/TagHandler.hxx" +#include "util/Alloc.hxx" #include "util/FormatString.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" @@ -53,7 +54,7 @@ static char * get_container_name(const char *path_fs) { const char *subtune_suffix = uri_get_suffix(path_fs); - char *path_container = g_strdup(path_fs); + char *path_container = xstrdup(path_fs); char pat[64]; snprintf(pat, sizeof(pat), "%s%s", @@ -137,7 +138,7 @@ gme_file_decode(Decoder &decoder, const char *path_fs) Music_Emu *emu; const char *gme_err = gme_open_file(path_container, &emu, GME_SAMPLE_RATE); - g_free(path_container); + free(path_container); if (gme_err != nullptr) { LogWarning(gme_domain, gme_err); return; diff --git a/src/decoder/SidplayDecoderPlugin.cxx b/src/decoder/SidplayDecoderPlugin.cxx index 160337594..9b3a4ad40 100644 --- a/src/decoder/SidplayDecoderPlugin.cxx +++ b/src/decoder/SidplayDecoderPlugin.cxx @@ -21,6 +21,7 @@ #include "SidplayDecoderPlugin.hxx" #include "../DecoderAPI.hxx" #include "tag/TagHandler.hxx" +#include "util/Alloc.hxx" #include "util/Domain.hxx" #include "system/ByteOrder.hxx" #include "Log.hxx" @@ -121,7 +122,7 @@ sidplay_finish() static char * get_container_name(const char *path_fs) { - char *path_container=g_strdup(path_fs); + char *path_container = strdup(path_fs); if(!g_pattern_match(path_with_subtune, strlen(path_container), path_container, nullptr)) @@ -163,9 +164,9 @@ get_song_length(const char *path_fs) if (songlength_database == nullptr) return -1; - gchar *sid_file=get_container_name(path_fs); + char *sid_file = get_container_name(path_fs); SidTuneMod tune(sid_file); - g_free(sid_file); + free(sid_file); if(!tune) { LogWarning(sidplay_domain, "failed to load file for calculating md5 sum"); -- cgit v1.2.3