diff options
author | Ran Benita <ran@unusedvar.com> | 2019-11-02 13:31:44 +0200 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2019-11-08 12:13:31 +0200 |
commit | 2af474e8d07eaa92a93953024685c66d1dbc15f5 (patch) | |
tree | c2e0de98cb0df1ed66d61d6db04743ff62292bfb /test | |
parent | 31e561fca9f2d6c9a0d0cc771d2bf77e6131ecdf (diff) | |
download | xorg-lib-libxkbcommon-2af474e8d07eaa92a93953024685c66d1dbc15f5.tar.gz |
parser: get rid of "stealing" atoms
This requires (well, at least implemented by) casting away `const` which
is undefined behavior, and clang started to warn about it.
The micro optimization didn't save too many allocations, anyway.
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/atom.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/atom.c b/test/atom.c index bcb369a..1d9ab85 100644 --- a/test/atom.c +++ b/test/atom.c @@ -27,7 +27,7 @@ #include "atom.h" #define INTERN_LITERAL(table, literal) \ - atom_intern(table, literal, sizeof(literal) - 1, false) + atom_intern(table, literal, sizeof(literal) - 1) #define LOOKUP_LITERAL(table, literal) \ atom_lookup(table, literal, sizeof(literal) - 1) @@ -105,7 +105,7 @@ test_random_strings(void) continue; } - arr[i].atom = atom_intern(table, arr[i].string, arr[i].len, false); + arr[i].atom = atom_intern(table, arr[i].string, arr[i].len); if (arr[i].atom == XKB_ATOM_NONE) { fprintf(stderr, "failed to intern! len: %lu, string: %.*s\n", arr[i].len, (int) arr[i].len, arr[i].string); @@ -161,7 +161,7 @@ main(void) assert(atom1 == LOOKUP_LITERAL(table, "hello")); assert(streq(atom_text(table, atom1), "hello")); - atom2 = atom_intern(table, "hello", 3, false); + atom2 = atom_intern(table, "hello", 3); assert(atom2 != XKB_ATOM_NONE); assert(atom1 != atom2); assert(streq(atom_text(table, atom2), "hel")); @@ -169,7 +169,7 @@ main(void) assert(LOOKUP_LITERAL(table, "hell") == XKB_ATOM_NONE); assert(LOOKUP_LITERAL(table, "hello") == atom1); - atom3 = atom_intern(table, "", 0, false); + atom3 = atom_intern(table, "", 0); assert(atom3 != XKB_ATOM_NONE); assert(LOOKUP_LITERAL(table, "") == atom3); |