caps: move the check to the public api.
authorStefan Kost <ensonic@users.sf.net>
Wed, 3 Mar 2010 21:37:01 +0000 (23:37 +0200)
committerStefan Kost <ensonic@users.sf.net>
Mon, 15 Mar 2010 09:17:22 +0000 (11:17 +0200)
This avoids creating empty caps and destroying them in the case of an error. We
also avoid double checking in other code path where we call the internal api.

gst/gstcaps.c

index 2804cd9..c2ca2bc 100644 (file)
@@ -2070,7 +2070,6 @@ gst_caps_from_string_inplace (GstCaps * caps, const gchar * string)
   GstStructure *structure;
   gchar *s;
 
-  g_return_val_if_fail (string, FALSE);
   if (strcmp ("ANY", string) == 0) {
     caps->flags = GST_CAPS_FLAGS_ANY;
     return TRUE;
@@ -2116,6 +2115,8 @@ gst_caps_from_string (const gchar * string)
 {
   GstCaps *caps;
 
+  g_return_val_if_fail (string, FALSE);
+
   caps = gst_caps_new_empty ();
   if (gst_caps_from_string_inplace (caps, string)) {
     return caps;