aboutsummaryrefslogtreecommitdiffstats
path: root/src/glib_compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/glib_compat.h')
-rw-r--r--src/glib_compat.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/glib_compat.h b/src/glib_compat.h
index 4d0e7040d..330c9e779 100644
--- a/src/glib_compat.h
+++ b/src/glib_compat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,12 @@
#define g_queue_clear(q) do { g_queue_free(q); q = g_queue_new(); } while (0)
+static inline GSource *
+g_timeout_source_new_seconds(guint interval)
+{
+ return g_timeout_source_new(interval * 1000);
+}
+
static inline guint
g_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
{
@@ -43,6 +49,12 @@ g_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
#if !GLIB_CHECK_VERSION(2,16,0)
static inline void
+g_prefix_error(G_GNUC_UNUSED GError **error_r,
+ G_GNUC_UNUSED const gchar *format, ...)
+{
+}
+
+static inline void
g_propagate_prefixed_error(GError **dest_r, GError *src,
G_GNUC_UNUSED const gchar *format, ...)
{
@@ -74,4 +86,27 @@ g_uri_parse_scheme(const char *uri)
#endif
+#if !GLIB_CHECK_VERSION(2,18,0)
+
+static inline void
+g_set_error_literal(GError **err, GQuark domain, gint code,
+ const gchar *message)
+{
+ g_set_error(err, domain, code, "%s", message);
+}
+
+#endif
+
+#if !GLIB_CHECK_VERSION(2,28,0)
+
+static inline gint64
+g_source_get_time(GSource *source)
+{
+ GTimeVal tv;
+ g_source_get_current_time(source, &tv);
+ return tv.tv_sec * 1000000 + tv.tv_usec;
+}
+
+#endif
+
#endif