aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-03-15 18:24:20 -0700
committerPaul Eggert2019-03-15 18:25:24 -0700
commit0eeb8c5920640be7309e00c9dcba6b7a07f741c1 (patch)
tree90d8fb5fdb3624190e12216ad417ab29f1fc9cd6 /src
parent18fb250d6748bd31672a9d2bdd5dff99ac7f7743 (diff)
downloademacs-0eeb8c5920640be7309e00c9dcba6b7a07f741c1.tar.gz
emacs-0eeb8c5920640be7309e00c9dcba6b7a07f741c1.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.h4
-rw-r--r--src/menu.c20
-rw-r--r--src/xmenu.c2
3 files changed, 12 insertions, 14 deletions
diff --git a/src/keyboard.h b/src/keyboard.h
index 0898c752ea4..65c7402ddb5 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -327,9 +327,9 @@ extern Lisp_Object item_properties;
327 takes care of protecting all the data from GC. */ 327 takes care of protecting all the data from GC. */
328extern Lisp_Object menu_items; 328extern Lisp_Object menu_items;
329 329
330/* If non-nil, means that the global vars defined here are already in use. 330/* Whether the global vars defined here are already in use.
331 Used to detect cases where we try to re-enter this non-reentrant code. */ 331 Used to detect cases where we try to re-enter this non-reentrant code. */
332extern Lisp_Object menu_items_inuse; 332extern bool menu_items_inuse;
333 333
334/* Number of slots currently allocated in menu_items. */ 334/* Number of slots currently allocated in menu_items. */
335extern int menu_items_allocated; 335extern int menu_items_allocated;
diff --git a/src/menu.c b/src/menu.c
index ea387dacbda..7d255fddac4 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -60,9 +60,9 @@ have_boxes (void)
60 60
61Lisp_Object menu_items; 61Lisp_Object menu_items;
62 62
63/* If non-nil, means that the global vars defined here are already in use. 63/* Whether the global vars defined here are already in use.
64 Used to detect cases where we try to re-enter this non-reentrant code. */ 64 Used to detect cases where we try to re-enter this non-reentrant code. */
65Lisp_Object menu_items_inuse; 65bool menu_items_inuse;
66 66
67/* Number of slots currently allocated in menu_items. */ 67/* Number of slots currently allocated in menu_items. */
68int menu_items_allocated; 68int menu_items_allocated;
@@ -80,7 +80,7 @@ static int menu_items_submenu_depth;
80void 80void
81init_menu_items (void) 81init_menu_items (void)
82{ 82{
83 if (!NILP (menu_items_inuse)) 83 if (menu_items_inuse)
84 error ("Trying to use a menu from within a menu-entry"); 84 error ("Trying to use a menu from within a menu-entry");
85 85
86 if (NILP (menu_items)) 86 if (NILP (menu_items))
@@ -89,7 +89,7 @@ init_menu_items (void)
89 menu_items = make_nil_vector (menu_items_allocated); 89 menu_items = make_nil_vector (menu_items_allocated);
90 } 90 }
91 91
92 menu_items_inuse = Qt; 92 menu_items_inuse = true;
93 menu_items_used = 0; 93 menu_items_used = 0;
94 menu_items_n_panes = 0; 94 menu_items_n_panes = 0;
95 menu_items_submenu_depth = 0; 95 menu_items_submenu_depth = 0;
@@ -105,7 +105,7 @@ finish_menu_items (void)
105void 105void
106unuse_menu_items (void) 106unuse_menu_items (void)
107{ 107{
108 menu_items_inuse = Qnil; 108 menu_items_inuse = false;
109} 109}
110 110
111/* Call when finished using the data for the current menu 111/* Call when finished using the data for the current menu
@@ -121,7 +121,7 @@ discard_menu_items (void)
121 menu_items = Qnil; 121 menu_items = Qnil;
122 menu_items_allocated = 0; 122 menu_items_allocated = 0;
123 } 123 }
124 eassert (NILP (menu_items_inuse)); 124 eassert (!menu_items_inuse);
125} 125}
126 126
127/* This undoes save_menu_items, and it is called by the specpdl unwind 127/* This undoes save_menu_items, and it is called by the specpdl unwind
@@ -131,7 +131,7 @@ static void
131restore_menu_items (Lisp_Object saved) 131restore_menu_items (Lisp_Object saved)
132{ 132{
133 menu_items = XCAR (saved); 133 menu_items = XCAR (saved);
134 menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil); 134 menu_items_inuse = ! NILP (menu_items);
135 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0); 135 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
136 saved = XCDR (saved); 136 saved = XCDR (saved);
137 menu_items_used = XFIXNUM (XCAR (saved)); 137 menu_items_used = XFIXNUM (XCAR (saved));
@@ -147,12 +147,12 @@ restore_menu_items (Lisp_Object saved)
147void 147void
148save_menu_items (void) 148save_menu_items (void)
149{ 149{
150 Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil, 150 Lisp_Object saved = list4 (menu_items_inuse ? menu_items : Qnil,
151 make_fixnum (menu_items_used), 151 make_fixnum (menu_items_used),
152 make_fixnum (menu_items_n_panes), 152 make_fixnum (menu_items_n_panes),
153 make_fixnum (menu_items_submenu_depth)); 153 make_fixnum (menu_items_submenu_depth));
154 record_unwind_protect (restore_menu_items, saved); 154 record_unwind_protect (restore_menu_items, saved);
155 menu_items_inuse = Qnil; 155 menu_items_inuse = false;
156 menu_items = Qnil; 156 menu_items = Qnil;
157} 157}
158 158
@@ -1578,8 +1578,6 @@ syms_of_menu (void)
1578{ 1578{
1579 menu_items = Qnil; 1579 menu_items = Qnil;
1580 staticpro (&menu_items); 1580 staticpro (&menu_items);
1581 menu_items_inuse = Qnil;
1582 staticpro (&menu_items_inuse);
1583 1581
1584 defsubr (&Sx_popup_menu); 1582 defsubr (&Sx_popup_menu);
1585 defsubr (&Sx_popup_dialog); 1583 defsubr (&Sx_popup_dialog);
diff --git a/src/xmenu.c b/src/xmenu.c
index fd7dea4cf8a..22d1cc21aa8 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -144,7 +144,7 @@ x_menu_set_in_use (bool in_use)
144{ 144{
145 Lisp_Object frames, frame; 145 Lisp_Object frames, frame;
146 146
147 menu_items_inuse = in_use ? Qt : Qnil; 147 menu_items_inuse = in_use;
148 popup_activated_flag = in_use; 148 popup_activated_flag = in_use;
149#ifdef USE_X_TOOLKIT 149#ifdef USE_X_TOOLKIT
150 if (popup_activated_flag) 150 if (popup_activated_flag)