Revert "structure: don't check type twice"

This reverts commit f864187bf5.

Reverting this as it changes behaviour and the documentation is
ambiguous about whether the caller must check the type first or
not (call must check type vs. returns NULL if not a string). If
GLib has been compiled with G_DISABLE_CHECKS then g_value_get_string()
may return complete garbage even if the value does not contain
a string. Better play it safe, esp. since the extra check is just
an integer comparison. For fundamental types we could return values
from the GValue structure directly if we really wanted to bypass
the extra check.
This commit is contained in:
Tim-Philipp Müller 2009-11-18 09:10:37 +00:00
parent f864187bf5
commit ab5f2f4f5d

View file

@ -1404,6 +1404,8 @@ gst_structure_get_string (const GstStructure * structure,
if (field == NULL)
return NULL;
if (!G_VALUE_HOLDS_STRING (&field->value))
return NULL;
return g_value_get_string (&field->value);
}