]> code.delx.au - gnu-emacs/commitdiff
Don't use XFASTINT on a negative number
authorAndreas Schwab <schwab@suse.de>
Tue, 6 Oct 2015 09:47:07 +0000 (11:47 +0200)
committerAndreas Schwab <schwab@suse.de>
Tue, 6 Oct 2015 09:52:06 +0000 (11:52 +0200)
* src/cmds.c (Fself_insert_command): Don't use XFASTINT on a negative
number.  (Bug#21633)

src/cmds.c

index ccc68911624b14b8d3fbf100e238b6183d1fa52a..39c5af99f5d195cc646f23cd958a194117bb68a9 100644 (file)
@@ -307,8 +307,8 @@ At the end, it runs `post-self-insert-hook'.  */)
 {
   CHECK_NUMBER (n);
 
-  if (XFASTINT (n) < 0)
-    error ("Negative repetition argument %"pI"d", XFASTINT (n));
+  if (XINT (n) < 0)
+    error ("Negative repetition argument %"pI"d", XINT (n));
 
   if (XFASTINT (n) < 2)
     remove_excessive_undo_boundaries ();
@@ -316,14 +316,15 @@ At the end, it runs `post-self-insert-hook'.  */)
   /* Barf if the key that invoked this was not a character.  */
   if (!CHARACTERP (last_command_event))
     bitch_at_user ();
-  else {
-    int character = translate_char (Vtranslation_table_for_input,
-                                   XINT (last_command_event));
-    int val = internal_self_insert (character, XFASTINT (n));
-    if (val == 2)
-      nonundocount = 0;
-    frame_make_pointer_invisible (SELECTED_FRAME ());
-  }
+  else
+    {
+      int character = translate_char (Vtranslation_table_for_input,
+                                     XINT (last_command_event));
+      int val = internal_self_insert (character, XFASTINT (n));
+      if (val == 2)
+       nonundocount = 0;
+      frame_make_pointer_invisible (SELECTED_FRAME ());
+    }
 
   return Qnil;
 }