gtestutils: Drop unnecessary NULL check

The macro wrapper to `g_assertion_message_cmpstrv()` makes sure that
neither array is `NULL`, so there’s no need for a second `NULL` check.
Additionally, this check happens after the arrays have already been
dereferenced, at which point the program would have crashed if the
arrays were `NULL`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Coverity CID: #1436406, #1436407
This commit is contained in:
Philip Withnall 2020-11-17 10:31:59 +00:00
parent bb4d9e8c6d
commit 065dea99f4

View File

@ -3055,8 +3055,8 @@ g_assertion_message_cmpstrv (const char *domain,
const char *s1 = arg1[first_wrong_idx], *s2 = arg2[first_wrong_idx];
char *a1, *a2, *s, *t1 = NULL, *t2 = NULL;
a1 = arg1 ? g_strconcat ("\"", t1 = g_strescape (s1, NULL), "\"", NULL) : g_strdup ("NULL");
a2 = arg2 ? g_strconcat ("\"", t2 = g_strescape (s2, NULL), "\"", NULL) : g_strdup ("NULL");
a1 = g_strconcat ("\"", t1 = g_strescape (s1, NULL), "\"", NULL);
a2 = g_strconcat ("\"", t2 = g_strescape (s2, NULL), "\"", NULL);
g_free (t1);
g_free (t2);
s = g_strdup_printf ("assertion failed (%s): first differing element at index %" G_GSIZE_FORMAT ": %s does not equal %s",