mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
tests/strfuncs: Do not compare string literal with pointers
Otherwise clang would complain: ../glib/tests/strfuncs.c:2603:32: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare] g_assert_true ((gpointer)str != (gpointer)""); ^ ~~~~~~~~~~~~ ../glib/gtestutils.h:187:59: note: expanded from macro 'g_assert_true' if G_LIKELY (expr) ; else \ ^~~~ ../glib/gmacros.h:1186:59: note: expanded from macro 'G_LIKELY' #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) ^~~~ ../glib/gmacros.h:1180:8: note: expanded from macro '_G_BOOLEAN_EXPR' if (expr)
This commit is contained in:
parent
8341a1cf06
commit
0de22a8864
@ -2593,20 +2593,21 @@ static void
|
|||||||
test_set_str (void)
|
test_set_str (void)
|
||||||
{
|
{
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
const char *empty_str = "";
|
||||||
|
|
||||||
g_assert_false (g_set_str (&str, NULL));
|
g_assert_false (g_set_str (&str, NULL));
|
||||||
g_assert_null (str);
|
g_assert_null (str);
|
||||||
|
|
||||||
g_assert_true (g_set_str (&str, ""));
|
g_assert_true (g_set_str (&str, empty_str));
|
||||||
g_assert_false (g_set_str (&str, ""));
|
g_assert_false (g_set_str (&str, empty_str));
|
||||||
g_assert_nonnull (str);
|
g_assert_nonnull (str);
|
||||||
g_assert_true ((gpointer)str != (gpointer)"");
|
g_assert_true ((gpointer)str != (gpointer)empty_str);
|
||||||
g_assert_cmpstr (str, ==, "");
|
g_assert_cmpstr (str, ==, empty_str);
|
||||||
|
|
||||||
g_assert_true (g_set_str (&str, NULL));
|
g_assert_true (g_set_str (&str, NULL));
|
||||||
g_assert_null (str);
|
g_assert_null (str);
|
||||||
|
|
||||||
g_assert_true (g_set_str (&str, ""));
|
g_assert_true (g_set_str (&str, empty_str));
|
||||||
g_assert_true (g_set_str (&str, "test"));
|
g_assert_true (g_set_str (&str, "test"));
|
||||||
g_assert_cmpstr (str, ==, "test");
|
g_assert_cmpstr (str, ==, "test");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user