test: move an assert up to before the strlen() use

../../../test/keysym.c:80:24: warning: Null pointer passed to 1st parameter
expecting 'nonnull' [core.NonNullParamChecker]
  (unsigned) strlen(expected));

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
master
Peter Hutterer 2021-03-30 08:08:58 +10:00 committed by Ran Benita
parent fa86433e7c
commit d172652753
1 changed files with 2 additions and 1 deletions

View File

@ -76,12 +76,13 @@ test_utf8(xkb_keysym_t keysym, const char *expected)
if (ret <= 0) if (ret <= 0)
return ret; return ret;
assert(expected != NULL);
fprintf(stderr, "Expected keysym %#x -> %s (%u bytes)\n", keysym, expected, fprintf(stderr, "Expected keysym %#x -> %s (%u bytes)\n", keysym, expected,
(unsigned) strlen(expected)); (unsigned) strlen(expected));
fprintf(stderr, "Received keysym %#x -> %s (%u bytes)\n\n", keysym, s, fprintf(stderr, "Received keysym %#x -> %s (%u bytes)\n\n", keysym, s,
(unsigned) strlen(s)); (unsigned) strlen(s));
assert(expected != NULL);
return streq(s, expected); return streq(s, expected);
} }