[telepathy-mission-control/master] fd.o #24875: reimplement g_error_new_valist to avoid a GLib 2.22 dependency
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Nov 3 07:03:03 PST 2009
---
src/mcd-dispatch-operation.c | 2 +-
src/mcd-misc.c | 14 ++++++++++++++
src/mcd-misc.h | 4 ++++
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 0341d0a..1b39cad 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -661,7 +661,7 @@ _mcd_dispatch_operation_finish (McdDispatchOperation *operation,
}
va_start (ap, format);
- priv->result = g_error_new_valist (domain, code, format, ap);
+ priv->result = _mcd_g_error_new_valist (domain, code, format, ap);
va_end (ap);
DEBUG ("Result: %s", priv->result->message);
diff --git a/src/mcd-misc.c b/src/mcd-misc.c
index 9ef33f7..049f340 100644
--- a/src/mcd-misc.c
+++ b/src/mcd-misc.c
@@ -242,3 +242,17 @@ _mcd_chmod_private (const gchar *filename)
return ret;
}
+
+/* FIXME: fd.o#24876: remove this when we depend on GLib 2.22 */
+GError *
+_mcd_g_error_new_valist (GQuark domain,
+ gint code,
+ const gchar *format,
+ va_list ap)
+{
+ gchar *message = g_strdup_vprintf (format, ap);
+ GError *error = g_error_new_literal (domain, code, message);
+
+ g_free (message);
+ return error;
+}
diff --git a/src/mcd-misc.h b/src/mcd-misc.h
index 76c37d3..61fe2c9 100644
--- a/src/mcd-misc.h
+++ b/src/mcd-misc.h
@@ -55,5 +55,9 @@ void _mc_ext_register_dbus_glib_marshallers (void);
G_GNUC_INTERNAL int _mcd_chmod_private (const gchar *filename);
+G_GNUC_INTERNAL GError *_mcd_g_error_new_valist (GQuark domain, gint code,
+ const gchar *format,
+ va_list ap);
+
G_END_DECLS
#endif /* MCD_MISC_H */
--
1.5.6.5
More information about the telepathy-commits
mailing list