From: Po Lu Date: Thu, 9 Jun 2022 01:52:21 +0000 (+0800) Subject: Make use of faster atom intern functions in xselect.c X-Git-Tag: emacs-29.0.90~1910^2~144 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dcb45946eee85dd8217fdfc4b728db1e24b16ebe;p=emacs.git 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. --- 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; }