From 9e46c320043ceab5e0aa788af03110561fe1a189 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 2 Jan 2009 17:22:47 +0100 Subject: playlist: use GLib instead of utils.h --- src/playlist.c | 26 +++++++++++++++----------- src/stored_playlist.c | 4 ++-- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/playlist.c b/src/playlist.c index 7abb7436f..303c54a6a 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -30,7 +30,6 @@ #include "log.h" #include "mapper.h" #include "path.h" -#include "utils.h" #include "state_file.h" #include "stored_playlist.h" #include "ack.h" @@ -43,6 +42,8 @@ #include #include #include +#include +#include #define PLAYLIST_STATE_STOP 0 #define PLAYLIST_STATE_PLAY 1 @@ -149,14 +150,17 @@ void initPlaylist(void) playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS; - playlist.songs = xmalloc(sizeof(struct song *) * playlist_max_length); - playlist.songMod = xmalloc(sizeof(uint32_t) * playlist_max_length); - playlist.order = xmalloc(sizeof(playlist.order[0]) * - playlist_max_length); - playlist.idToPosition = xmalloc(sizeof(int) * playlist_max_length * - PLAYLIST_HASH_MULT); - playlist.positionToId = xmalloc(sizeof(playlist.positionToId[0]) * - playlist_max_length); + playlist.songs = g_malloc(sizeof(playlist.songs[0]) * + playlist_max_length); + playlist.songMod = g_malloc(sizeof(playlist.songMod[0]) * + playlist_max_length); + playlist.order = g_malloc(sizeof(playlist.order[0]) * + playlist_max_length); + playlist.idToPosition = g_malloc(sizeof(playlist.idToPosition[0]) * + playlist_max_length * + PLAYLIST_HASH_MULT); + playlist.positionToId = g_malloc(sizeof(playlist.positionToId[0]) * + playlist_max_length); memset(playlist.songs, 0, sizeof(char *) * playlist_max_length); @@ -1335,7 +1339,7 @@ enum playlist_result loadPlaylist(struct client *client, const char *utf8file) const char *temp = g_ptr_array_index(list, i); if ((addToPlaylist(temp, NULL)) != PLAYLIST_RESULT_SUCCESS) { /* for windows compatibility, convert slashes */ - char *temp2 = xstrdup(temp); + char *temp2 = g_strdup(temp); char *p = temp2; while (*p) { if (*p == '\\') @@ -1358,7 +1362,7 @@ void searchForSongsInPlaylist(struct client *client, unsigned numItems, LocateTagItem * items) { unsigned i; - char **originalNeedles = xmalloc(numItems * sizeof(char *)); + char **originalNeedles = g_malloc(numItems * sizeof(char *)); for (i = 0; i < numItems; i++) { originalNeedles[i] = items[i].needle; diff --git a/src/stored_playlist.c b/src/stored_playlist.c index fa1ae7cc9..a21feeeee 100644 --- a/src/stored_playlist.c +++ b/src/stored_playlist.c @@ -21,7 +21,6 @@ #include "song.h" #include "mapper.h" #include "path.h" -#include "utils.h" #include "ls.h" #include "database.h" #include "idle.h" @@ -32,6 +31,7 @@ #include #include #include +#include static struct stored_playlist_info * load_playlist_info(const char *parent_path_fs, const char *name_fs) @@ -179,7 +179,7 @@ spl_load(const char *utf8path) s = song_get_url(song, path_max_tmp); } - g_ptr_array_add(list, xstrdup(s)); + g_ptr_array_add(list, g_strdup(s)); if (list->len >= playlist_max_length) break; -- cgit v1.2.3