[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0eeb8c5: Use bool for menu_items_inuse
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 0eeb8c5: Use bool for menu_items_inuse |
Date: |
Fri, 15 Mar 2019 21:25:29 -0400 (EDT) |
branch: master
commit 0eeb8c5920640be7309e00c9dcba6b7a07f741c1
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Use bool for menu_items_inuse
* src/menu.c (menu_items_inuse): Now bool, instead of a
Lisp_Object that is always Qt or Qnil. All uses changed.
---
src/keyboard.h | 4 ++--
src/menu.c | 20 +++++++++-----------
src/xmenu.c | 2 +-
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/keyboard.h b/src/keyboard.h
index 0898c75..65c7402 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -327,9 +327,9 @@ extern Lisp_Object item_properties;
takes care of protecting all the data from GC. */
extern Lisp_Object menu_items;
-/* If non-nil, means that the global vars defined here are already in use.
+/* Whether the global vars defined here are already in use.
Used to detect cases where we try to re-enter this non-reentrant code. */
-extern Lisp_Object menu_items_inuse;
+extern bool menu_items_inuse;
/* Number of slots currently allocated in menu_items. */
extern int menu_items_allocated;
diff --git a/src/menu.c b/src/menu.c
index ea387da..7d255fd 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -60,9 +60,9 @@ have_boxes (void)
Lisp_Object menu_items;
-/* If non-nil, means that the global vars defined here are already in use.
+/* Whether the global vars defined here are already in use.
Used to detect cases where we try to re-enter this non-reentrant code. */
-Lisp_Object menu_items_inuse;
+bool menu_items_inuse;
/* Number of slots currently allocated in menu_items. */
int menu_items_allocated;
@@ -80,7 +80,7 @@ static int menu_items_submenu_depth;
void
init_menu_items (void)
{
- if (!NILP (menu_items_inuse))
+ if (menu_items_inuse)
error ("Trying to use a menu from within a menu-entry");
if (NILP (menu_items))
@@ -89,7 +89,7 @@ init_menu_items (void)
menu_items = make_nil_vector (menu_items_allocated);
}
- menu_items_inuse = Qt;
+ menu_items_inuse = true;
menu_items_used = 0;
menu_items_n_panes = 0;
menu_items_submenu_depth = 0;
@@ -105,7 +105,7 @@ finish_menu_items (void)
void
unuse_menu_items (void)
{
- menu_items_inuse = Qnil;
+ menu_items_inuse = false;
}
/* Call when finished using the data for the current menu
@@ -121,7 +121,7 @@ discard_menu_items (void)
menu_items = Qnil;
menu_items_allocated = 0;
}
- eassert (NILP (menu_items_inuse));
+ eassert (!menu_items_inuse);
}
/* This undoes save_menu_items, and it is called by the specpdl unwind
@@ -131,7 +131,7 @@ static void
restore_menu_items (Lisp_Object saved)
{
menu_items = XCAR (saved);
- menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
+ menu_items_inuse = ! NILP (menu_items);
menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
saved = XCDR (saved);
menu_items_used = XFIXNUM (XCAR (saved));
@@ -147,12 +147,12 @@ restore_menu_items (Lisp_Object saved)
void
save_menu_items (void)
{
- Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
+ Lisp_Object saved = list4 (menu_items_inuse ? menu_items : Qnil,
make_fixnum (menu_items_used),
make_fixnum (menu_items_n_panes),
make_fixnum (menu_items_submenu_depth));
record_unwind_protect (restore_menu_items, saved);
- menu_items_inuse = Qnil;
+ menu_items_inuse = false;
menu_items = Qnil;
}
@@ -1578,8 +1578,6 @@ syms_of_menu (void)
{
menu_items = Qnil;
staticpro (&menu_items);
- menu_items_inuse = Qnil;
- staticpro (&menu_items_inuse);
defsubr (&Sx_popup_menu);
defsubr (&Sx_popup_dialog);
diff --git a/src/xmenu.c b/src/xmenu.c
index fd7dea4..22d1cc2 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -144,7 +144,7 @@ x_menu_set_in_use (bool in_use)
{
Lisp_Object frames, frame;
- menu_items_inuse = in_use ? Qt : Qnil;
+ menu_items_inuse = in_use;
popup_activated_flag = in_use;
#ifdef USE_X_TOOLKIT
if (popup_activated_flag)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0eeb8c5: Use bool for menu_items_inuse,
Paul Eggert <=