check: Add _fail_unless() compatibility function around _ck_assert_failed()
authorSebastian Dröge <sebastian@centricular.com>
Wed, 21 Jan 2015 17:07:09 +0000 (18:07 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 21 Jan 2015 17:09:38 +0000 (18:09 +0100)
We exported this in < 1.5 and it was automatically used by many macros
from the header. Keep it exported for now.

libs/gst/check/Makefile.am
libs/gst/check/gstcheck.c

index abc3b3a..8c2a1b3 100644 (file)
@@ -109,10 +109,14 @@ LIBGSTCHECK_EXPORTED_FUNCS = \
        gst_test_clock_process_id_list \
        gst_test_clock_id_list_get_latest_time
 
+# For backwards compatibility with GStreamer < 1.5
+LIBGSTCHECK_EXPORTED_COMPAT_FUNCS = \
+       _fail_unless
 
 LIBGSTCHECK_EXPORTED_SYMBOLS = \
        $(LIBGSTCHECK_EXPORTED_VARS) \
-       $(LIBGSTCHECK_EXPORTED_FUNCS)
+       $(LIBGSTCHECK_EXPORTED_FUNCS) \
+       $(LIBGSTCHECK_EXPORTED_COMPAT_FUNCS)
 
 # Please do not even think about changing the alphabet below into A-Za-z.
 # It is there for purpose. (Bug #602093)
index 3d75b54..a803961 100644 (file)
@@ -1012,3 +1012,27 @@ gst_check_object_destroyed_on_unref (gpointer object_to_unref)
 {
   gst_check_objects_destroyed_on_unref (object_to_unref, NULL, NULL);
 }
+
+/* For ABI compatibility with GStreamer < 1.5 */
+void
+_fail_unless (int result, const char *file, int line, const char *expr, ...)
+G_GNUC_PRINTF (4, 5);
+
+void _fail_unless (int result, const char *file, int line,
+    const char *expr, ...)
+{
+  gchar *msg;
+  va_list args;
+
+  if (result) {
+    _mark_point(file, line);
+    return;
+  }
+
+  va_start (args, expr);
+  msg = g_strdup_vprintf (expr, args);
+  va_end (args);
+
+  _ck_assert_failed (file, line, msg, NULL);
+  g_free (msg);
+}