2 * Copyright (C) 2003-2009 The Music Player Daemon Project
3 * http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * Compatibility with older GLib versions. Some of this isn't
22 * implemented properly, just "good enough" to allow users with older
23 * operating systems to run MPD.
26 #ifndef MPD_GLIB_COMPAT_H
27 #define MPD_GLIB_COMPAT_H
31 #if !GLIB_CHECK_VERSION(2,14,0)
33 #define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
36 g_timeout_add_seconds(guint interval
, GSourceFunc function
, gpointer data
)
38 return g_timeout_add(interval
* 1000, function
, data
);
43 #if !GLIB_CHECK_VERSION(2,16,0)
46 g_propagate_prefixed_error(GError
**dest_r
, GError
*src
,
47 G_GNUC_UNUSED
const gchar
*format
, ...)
49 g_propagate_error(dest_r
, src
);
53 g_uri_escape_string(const char *unescaped
,
54 G_GNUC_UNUSED
const char *reserved_chars_allowed
,
55 G_GNUC_UNUSED gboolean allow_utf8
)
57 return g_strdup(unescaped
);