gststructure: rejig test ordering for speed
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 27 Oct 2011 08:45:41 +0000 (09:45 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 7 Nov 2011 15:16:26 +0000 (15:16 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=662777

gst/gststructure.c

index b9abcf6..a254797 100644 (file)
@@ -3137,13 +3137,14 @@ gst_caps_structure_is_subset_field (GQuark field_id, const GValue * value,
    *
    *  First caps subtraction needs to return a non-empty set, second
    *  subtractions needs to give en empty set.
+   *  Both substractions are switched below, as it's faster that way.
    */
-  if (gst_value_subtract (&subtraction, other, value)) {
-    g_value_unset (&subtraction);
-    /* !empty result, swapping must be empty */
-    if (!gst_value_subtract (&subtraction, value, other))
+  if (!gst_value_subtract (&subtraction, value, other)) {
+    if (gst_value_subtract (&subtraction, other, value)) {
+      g_value_unset (&subtraction);
       return TRUE;
-
+    }
+  } else {
     g_value_unset (&subtraction);
   }
   return FALSE;