From 4390d72b141304b8dfcdb374b428d3b4fae56237 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 13 Oct 2009 16:12:43 +0200 Subject: configure.ac: require GLib 2.16 Accidently, MPD has been using several GLib 2.16 functions for a while, and nobody noticed yet. To simplify the code base, let's bump the minimum GLib version for MPD to 2.16. That version is old enough, and it's reasonable to expect users to have it. --- INSTALL | 2 +- NEWS | 1 + configure.ac | 4 ++-- src/cmdline.c | 4 ---- src/input/curl_input_plugin.c | 5 ----- src/input/lastfm_input_plugin.c | 13 ------------- src/main.c | 2 -- src/output/httpd_client.c | 5 ----- 8 files changed, 4 insertions(+), 32 deletions(-) diff --git a/INSTALL b/INSTALL index 360461d84..82cb0c712 100644 --- a/INSTALL +++ b/INSTALL @@ -13,7 +13,7 @@ Dependencies gcc - http://gcc.gnu.org/ Any other C99 compliant compiler should also work. -glib - http://www.gtk.org/ +GLib 2.16 - http://www.gtk.org/ General-purpose utility library. diff --git a/NEWS b/NEWS index 57790b074..46f85ec09 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,7 @@ ver 0.16 (20??/??/??) * state_file: save only if something has changed * obey $(sysconfdir) for default mpd.conf location * build with large file support by default +* require GLib 2.16 ver 0.15.5 (2009/??/??) diff --git a/configure.ac b/configure.ac index 917bda86b..885115971 100644 --- a/configure.ac +++ b/configure.ac @@ -128,8 +128,8 @@ dnl dnl mandatory libraries dnl -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.6 gthread-2.0],, - [AC_MSG_ERROR([glib-2.6 is required])]) +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16 gthread-2.0],, + [AC_MSG_ERROR([glib-2.16 is required])]) dnl diff --git a/src/cmdline.c b/src/cmdline.c index 9e3919152..5dd6b26d6 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -77,10 +77,8 @@ static void version(void) exit(EXIT_SUCCESS); } -#if GLIB_CHECK_VERSION(2,12,0) static const char *summary = "Music Player Daemon - a daemon for playing music."; -#endif bool parse_cmdline(int argc, char **argv, struct options *options, @@ -118,9 +116,7 @@ parse_cmdline(int argc, char **argv, struct options *options, context = g_option_context_new("[path/to/mpd.conf]"); g_option_context_add_main_entries(context, entries, NULL); -#if GLIB_CHECK_VERSION(2,12,0) g_option_context_set_summary(context, summary); -#endif ret = g_option_context_parse(context, &argc, &argv, &error); g_option_context_free(context); diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index 2418f27bc..a75245d06 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -150,11 +150,6 @@ buffer_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) g_free(data); } -/* g_queue_clear() was introduced in GLib 2.14 */ -#if !GLIB_CHECK_VERSION(2,14,0) -#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0) -#endif - /** * Frees the current "libcurl easy" handle, and everything associated * with it. diff --git a/src/input/lastfm_input_plugin.c b/src/input/lastfm_input_plugin.c index 4e13cd0ad..fc541ca28 100644 --- a/src/input/lastfm_input_plugin.c +++ b/src/input/lastfm_input_plugin.c @@ -55,18 +55,12 @@ lastfm_input_init(const struct config_param *param) if (passwd == NULL || user == NULL) return false; -#if GLIB_CHECK_VERSION(2,16,0) lastfm_data.user = g_uri_escape_string(user, NULL, false); -#else - lastfm_data.user = g_strdup(user); -#endif -#if GLIB_CHECK_VERSION(2,16,0) if (strlen(passwd) != 32) lastfm_data.md5 = g_compute_checksum_for_string(G_CHECKSUM_MD5, passwd, strlen(passwd)); else -#endif lastfm_data.md5 = g_strdup(passwd); return true; @@ -364,23 +358,16 @@ lastfm_input_open(struct input_stream *is, const char *url) return false; } -#if GLIB_CHECK_VERSION(2,16,0) q = g_uri_escape_string(session, NULL, false); g_free(session); session = q; -#endif /* "adjust" last.fm radio */ if (strlen(url) > 9) { char *escaped_url; -#if GLIB_CHECK_VERSION(2,16,0) escaped_url = g_uri_escape_string(url, NULL, false); -#else - escaped_url = g_strdup(url); -#endif - p = g_strconcat("http://ws.audioscrobbler.com/radio/adjust.php?" "session=", session, "&url=", escaped_url, "&debug=0", NULL); diff --git a/src/main.c b/src/main.c index d721bfe00..e601fb6bf 100644 --- a/src/main.c +++ b/src/main.c @@ -108,10 +108,8 @@ glue_mapper_init(void) const char *music_dir, *playlist_dir; music_dir = config_get_path(CONF_MUSIC_DIR); -#if GLIB_CHECK_VERSION(2,14,0) if (music_dir == NULL) music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); -#endif playlist_dir = config_get_path(CONF_PLAYLIST_DIR); diff --git a/src/output/httpd_client.c b/src/output/httpd_client.c index 52a398e3b..8157ebb44 100644 --- a/src/output/httpd_client.c +++ b/src/output/httpd_client.c @@ -482,11 +482,6 @@ httpd_client_queue_size(const struct httpd_client *client) return size; } -/* g_queue_clear() was introduced in GLib 2.14 */ -#if !GLIB_CHECK_VERSION(2,14,0) -#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0) -#endif - void httpd_client_cancel(struct httpd_client *client) { -- cgit v1.2.3