testsuite: Fix potential strcmp() against NULL

Use g_strcmp0() instead.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
This commit is contained in:
Philip Withnall
2013-11-20 17:39:21 +00:00
parent ada766025f
commit 9d7a442b8b

View File

@ -225,7 +225,7 @@ object_test_property (GObject *object,
(MATCH_ANY_VALUE == ignore_properties[i].value || (MATCH_ANY_VALUE == ignore_properties[i].value ||
value_as_pointer (&value) == ignore_properties[i].value || value_as_pointer (&value) == ignore_properties[i].value ||
(G_VALUE_HOLDS_STRING (&value) && (G_VALUE_HOLDS_STRING (&value) &&
strcmp (g_value_get_string (&value), ignore_properties[i].value) == 0)))) g_strcmp0 (g_value_get_string (&value), ignore_properties[i].value) == 0))))
break; break;
/* ignore known property bugs if not testing thoroughly */ /* ignore known property bugs if not testing thoroughly */
if (ignore_properties[i].name == NULL && !g_test_thorough ()) if (ignore_properties[i].name == NULL && !g_test_thorough ())
@ -237,7 +237,7 @@ object_test_property (GObject *object,
(MATCH_ANY_VALUE == ignore_properties[i].value || (MATCH_ANY_VALUE == ignore_properties[i].value ||
value_as_pointer (&value) == ignore_properties[i].value || value_as_pointer (&value) == ignore_properties[i].value ||
(G_VALUE_HOLDS_STRING (&value) && (G_VALUE_HOLDS_STRING (&value) &&
strcmp (g_value_get_string (&value), ignore_properties[i].value) == 0))) g_strcmp0 (g_value_get_string (&value), ignore_properties[i].value) == 0)))
break; break;
} }
/* assign unignored properties */ /* assign unignored properties */