summaryrefslogtreecommitdiff
path: root/src/xkbcomp
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2019-11-02 13:31:44 +0200
committerRan Benita <ran@unusedvar.com>2019-11-08 12:13:31 +0200
commit2af474e8d07eaa92a93953024685c66d1dbc15f5 (patch)
treec2e0de98cb0df1ed66d61d6db04743ff62292bfb /src/xkbcomp
parent31e561fca9f2d6c9a0d0cc771d2bf77e6131ecdf (diff)
downloadxorg-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 'src/xkbcomp')
-rw-r--r--src/xkbcomp/parser.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index 296ce19..f33a850 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -747,11 +747,11 @@ Integer : INTEGER { $$ = $1; }
KeyCode : INTEGER { $$ = $1; }
;
-Ident : IDENT { $$ = xkb_atom_steal(param->ctx, $1); }
+Ident : IDENT { $$ = xkb_atom_intern(param->ctx, $1, strlen($1)); free($1); }
| DEFAULT { $$ = xkb_atom_intern_literal(param->ctx, "default"); }
;
-String : STRING { $$ = xkb_atom_steal(param->ctx, $1); }
+String : STRING { $$ = xkb_atom_intern(param->ctx, $1, strlen($1)); free($1); }
;
OptMapName : MapName { $$ = $1; }