aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-06-01 08:23:29 +0200
committerMax Kellermann <max@duempel.org>2010-06-01 09:59:52 +0200
commit747e945d29e847403cec928ca4a3df7f27864cfc (patch)
tree0ceb2b49b079dbc26427791943772e969b67d1e6
parent067d7212bf8ee5a8f3f6b93c6d86ab86d0106fcd (diff)
downloadmpd-747e945d29e847403cec928ca4a3df7f27864cfc.tar.gz
mpd-747e945d29e847403cec928ca4a3df7f27864cfc.tar.xz
mpd-747e945d29e847403cec928ca4a3df7f27864cfc.zip
playlist_list: move fallback g_uri_parse_scheme() to glib_compat.h
-rw-r--r--src/glib_compat.h15
-rw-r--r--src/playlist_list.c15
2 files changed, 16 insertions, 14 deletions
diff --git a/src/glib_compat.h b/src/glib_compat.h
index 732f12753..4d0e7040d 100644
--- a/src/glib_compat.h
+++ b/src/glib_compat.h
@@ -59,4 +59,19 @@ g_uri_escape_string(const char *unescaped,
#endif /* !2.16 */
+#if !GLIB_CHECK_VERSION(2,16,0)
+
+#include <string.h>
+
+static inline char *
+g_uri_parse_scheme(const char *uri)
+{
+ const char *end = strstr(uri, "://");
+ if (end == NULL)
+ return NULL;
+ return g_strndup(uri, end - uri);
+}
+
+#endif
+
#endif
diff --git a/src/playlist_list.c b/src/playlist_list.c
index a836beb35..1419c6ac8 100644
--- a/src/playlist_list.c
+++ b/src/playlist_list.c
@@ -32,8 +32,7 @@
#include "uri.h"
#include "utils.h"
#include "conf.h"
-
-#include <glib.h>
+#include "glib_compat.h"
#include <assert.h>
#include <string.h>
@@ -112,18 +111,6 @@ playlist_list_global_finish(void)
playlist_plugin_finish(playlist_plugins[i]);
}
-/* g_uri_parse_scheme() was introduced in GLib 2.16 */
-#if !GLIB_CHECK_VERSION(2,16,0)
-static char *
-g_uri_parse_scheme(const char *uri)
-{
- const char *end = strstr(uri, "://");
- if (end == NULL)
- return NULL;
- return g_strndup(uri, end - uri);
-}
-#endif
-
static struct playlist_provider *
playlist_list_open_uri_scheme(const char *uri, bool *tried)
{