use GLIB_CHECK_VERSION()

Use GLIB_CHECK_VERSION() instead of manually checking
GLIB_MAJOR_VERSION, ...
This commit is contained in:
Max Kellermann 2009-03-01 00:37:22 +01:00
parent 82b081a6db
commit ae87abae59
3 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ static void version(void)
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 12) #if GLIB_CHECK_VERSION(2,12,0)
static const char *summary = static const char *summary =
"Music Player Daemon - a daemon for playing music."; "Music Player Daemon - a daemon for playing music.";
#endif #endif
@ -108,7 +108,7 @@ void parseOptions(int argc, char **argv, Options *options)
context = g_option_context_new("[path/to/mpd.conf]"); context = g_option_context_new("[path/to/mpd.conf]");
g_option_context_add_main_entries(context, entries, NULL); g_option_context_add_main_entries(context, entries, NULL);
#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 12) #if GLIB_CHECK_VERSION(2,12,0)
g_option_context_set_summary(context, summary); g_option_context_set_summary(context, summary);
#endif #endif

View File

@ -119,7 +119,7 @@ buffer_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
} }
/* g_queue_clear() was introduced in GLib 2.14 */ /* g_queue_clear() was introduced in GLib 2.14 */
#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14 #if GLIB_CHECK_VERSION(2,14,0)
#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0) #define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
#endif #endif

View File

@ -96,7 +96,7 @@ void mapper_init(void)
path = config_get_path(CONF_MUSIC_DIR); path = config_get_path(CONF_MUSIC_DIR);
if (path != NULL) if (path != NULL)
mapper_set_music_dir(path); mapper_set_music_dir(path);
#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 14) #if GLIB_CHECK_VERSION(2,14,0)
else { else {
path = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC); path = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
if (path != NULL) if (path != NULL)