emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114627: * term.c (tty_menu_show): Never return with


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114627: * term.c (tty_menu_show): Never return with unbalanced
Date: Fri, 11 Oct 2013 15:30:55 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114627
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-11 19:30:21 +0400
message:
  * term.c (tty_menu_show): Never return with unbalanced
  specpdl.  Use eassert for debugging check.  Adjust style.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-11 14:42:05 +0000
+++ b/src/ChangeLog     2013-10-11 15:30:21 +0000
@@ -1,3 +1,8 @@
+2013-10-11  Dmitry Antipov  <address@hidden>
+
+       * term.c (tty_menu_show): Never return with unbalanced
+       specpdl.  Use eassert for debugging check.  Adjust style.
+
 2013-10-11  Eli Zaretskii  <address@hidden>
 
        * term.c (read_menu_input): Make selection of menu items

=== modified file 'src/term.c'
--- a/src/term.c        2013-10-11 14:42:05 +0000
+++ b/src/term.c        2013-10-11 15:30:21 +0000
@@ -3561,10 +3561,9 @@
   int dispwidth, dispheight;
   int i, j, lines, maxlines;
   int maxwidth;
-  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count;
 
-  if (! FRAME_TERMCAP_P (f))
-    emacs_abort ();
+  eassert (FRAME_TERMCAP_P (f));
 
   *error_name = 0;
   if (menu_items_n_panes == 0)
@@ -3586,7 +3585,7 @@
 
   /* Don't GC while we prepare and show the menu, because we give the
      menu functions pointers to the contents of strings.  */
-  inhibit_garbage_collection ();
+  specpdl_count = inhibit_garbage_collection ();
 
   /* Adjust coordinates to be root-window-relative.  */
   item_x = x += f->left_pos;
@@ -3617,7 +3616,8 @@
            {
              tty_menu_destroy (menu);
              *error_name = "Can't create pane";
-             return Qnil;
+             entry = Qnil;
+             goto tty_menu_end;
            }
          i += MENU_ITEMS_PANE_LENGTH;
 
@@ -3679,7 +3679,8 @@
            {
              tty_menu_destroy (menu);
              *error_name = "Can't add selection to menu";
-             return Qnil;
+             entry = Qnil;
+             goto tty_menu_end;
            }
          i += MENU_ITEMS_ITEM_LENGTH;
           lines++;
@@ -3696,12 +3697,12 @@
   x = max (x, 1);
   y = max (y, 1);
   tty_menu_locate (menu, x, y, &ulx, &uly, &width, &height);
-  if (ulx+width > dispwidth)
+  if (ulx + width > dispwidth)
     {
       x -= (ulx + width) - dispwidth;
       ulx = dispwidth - width;
     }
-  if (uly+height > dispheight)
+  if (uly + height > dispheight)
     {
       y -= (uly + height) - dispheight;
       uly = dispheight - height;
@@ -3807,8 +3808,9 @@
       break;
     }
 
+ tty_menu_end:
+
   unbind_to (specpdl_count, Qnil);
-
   return entry;
 }
 


reply via email to

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