emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117938: * keyboard.c (make_lispy_event): Avoid unne


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117938: * keyboard.c (make_lispy_event): Avoid unnecessary tests
Date: Wed, 24 Sep 2014 18:25:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117938
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2014-09-24 11:25:04 -0700
message:
  * keyboard.c (make_lispy_event): Avoid unnecessary tests
  
  of bit 28 and of whether an unsigned value is negative.
  This simplifies the code a bit, and pacifies clang 3.4.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/keyboard.c                 keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-24 11:59:13 +0000
+++ b/src/ChangeLog     2014-09-24 18:25:04 +0000
@@ -1,3 +1,9 @@
+2014-09-24  Paul Eggert  <address@hidden>
+
+       * keyboard.c (make_lispy_event): Avoid unnecessary tests
+       of bit 28 and of whether an unsigned value is negative.
+       This simplifies the code a bit, and pacifies clang 3.4.
+
 2014-09-24  Eli Zaretskii  <address@hidden>
 
        * systime.h (Time): Define as size_t, to be consistent with 64-bit

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2014-09-24 07:17:51 +0000
+++ b/src/keyboard.c    2014-09-24 18:25:04 +0000
@@ -5548,30 +5548,27 @@
                                     ARRAYELTS (iso_lispy_function_keys));
 #endif
 
-      /* Handle system-specific or unknown keysyms.  */
-      if (event->code & (1 << 28)
-         || event->code - FUNCTION_KEY_OFFSET < 0
-         || (event->code - FUNCTION_KEY_OFFSET
-             >= ARRAYELTS (lispy_function_keys))
-         || !lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
-       {
-         /* We need to use an alist rather than a vector as the cache
-            since we can't make a vector long enough.  */
-         if (NILP (KVAR (current_kboard, system_key_syms)))
-           kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
-         return modify_event_symbol (event->code,
-                                     event->modifiers,
-                                     Qfunction_key,
-                                     KVAR (current_kboard, Vsystem_key_alist),
-                                     0, &KVAR (current_kboard, 
system_key_syms),
-                                     PTRDIFF_MAX);
-       }
+      if ((FUNCTION_KEY_OFFSET <= event->code
+          && (event->code
+              < FUNCTION_KEY_OFFSET + ARRAYELTS (lispy_function_keys)))
+         && lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
+       return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
+                                   event->modifiers,
+                                   Qfunction_key, Qnil,
+                                   lispy_function_keys, &func_key_syms,
+                                   ARRAYELTS (lispy_function_keys));
 
-      return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
+      /* Handle system-specific or unknown keysyms.
+        We need to use an alist rather than a vector as the cache
+        since we can't make a vector long enough.  */
+      if (NILP (KVAR (current_kboard, system_key_syms)))
+       kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
+      return modify_event_symbol (event->code,
                                  event->modifiers,
-                                 Qfunction_key, Qnil,
-                                 lispy_function_keys, &func_key_syms,
-                                  ARRAYELTS (lispy_function_keys));
+                                 Qfunction_key,
+                                 KVAR (current_kboard, Vsystem_key_alist),
+                                 0, &KVAR (current_kboard, system_key_syms),
+                                 PTRDIFF_MAX);
 
 #ifdef HAVE_NTGUI
     case MULTIMEDIA_KEY_EVENT:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]