pluginutils: add G_PRIMITIVE_SWAP() helper macro.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 6 Sep 2012 09:47:40 +0000 (11:47 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 6 Sep 2012 11:39:50 +0000 (13:39 +0200)
This macro helps swapping variables while maintaining the correct underlying
and primitive type.

gst/vaapi/gstvaapipluginutil.h

index b55374b..78f274f 100644 (file)
@@ -50,4 +50,10 @@ G_GNUC_INTERNAL
 gboolean
 gst_vaapi_append_surface_caps (GstCaps *out_caps, GstCaps *in_caps);
 
+#ifndef G_PRIMITIVE_SWAP
+#define G_PRIMITIVE_SWAP(type, a, b) do {       \
+        const type t = a; a = b; b = t;         \
+    } while (0)
+#endif
+
 #endif /* GST_VAAPI_PLUGIN_UTIL_H */