Commit d172652753b2d13587e5b61199e3113ceae55e68

Peter Hutterer 2021-03-30T08:08:58

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>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/test/keysym.c b/test/keysym.c
index bb2ec28..3210770 100644
--- a/test/keysym.c
+++ b/test/keysym.c
@@ -76,12 +76,13 @@ test_utf8(xkb_keysym_t keysym, const char *expected)
     if (ret <= 0)
         return ret;
 
+    assert(expected != NULL);
+
     fprintf(stderr, "Expected keysym %#x -> %s (%u bytes)\n", keysym, expected,
             (unsigned) strlen(expected));
     fprintf(stderr, "Received keysym %#x -> %s (%u bytes)\n\n", keysym, s,
             (unsigned) strlen(s));
 
-    assert(expected != NULL);
     return streq(s, expected);
 }