From dcb45946eee85dd8217fdfc4b728db1e24b16ebe Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 9 Jun 2022 09:52:21 +0800 Subject: [PATCH] Make use of faster atom intern functions in xselect.c * src/xselect.c (symbol_to_x_atom): (x_atom_to_symbol): Use x_get_atom_name and x_intern_cached_atom. --- src/xselect.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/xselect.c b/src/xselect.c index a234c7188f3..17fe7403b24 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -170,7 +170,7 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym) TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); block_input (); - val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False); + val = x_intern_cached_atom (dpyinfo, SSDATA (SYMBOL_NAME (sym)), false); unblock_input (); return val; } @@ -233,18 +233,17 @@ x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom) if (atom == dpyinfo->Xatom_XmTRANSFER_FAILURE) return QXmTRANSFER_FAILURE; - block_input (); x_catch_errors (dpyinfo->display); - str = XGetAtomName (dpyinfo->display, atom); + str = x_get_atom_name (dpyinfo, atom, NULL); x_uncatch_errors (); - unblock_input (); + + TRACE0 ("XGetAtomName --> NULL"); + if (!str) + return Qnil; TRACE1 ("XGetAtomName --> %s", str); - if (! str) return Qnil; + val = intern (str); - block_input (); - /* This was allocated by Xlib, so use XFree. */ - XFree (str); - unblock_input (); + xfree (str); return val; } -- 2.39.2