Skip to content

Commit 91b2b36

Browse files
committed
Turn macros into enums in keyboard.h
* src/keyboard.h (item_property_idx, menu_item_pane_idx): Turn macros into enums. (ITEM_PROPERTY_MAX): New constant. * src/keyboard.c (parse_menu_item): Use above new constant.
1 parent efd4fb5 commit 91b2b36

File tree

2 files changed

+36
-28
lines changed

2 files changed

+36
-28
lines changed

src/keyboard.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8713,10 +8713,10 @@ parse_menu_item (Lisp_Object item, int inmenubar)
87138713

87148714
/* Create item_properties vector if necessary. */
87158715
if (NILP (item_properties))
8716-
item_properties = make_nil_vector (ITEM_PROPERTY_ENABLE + 1);
8716+
item_properties = make_nil_vector (ITEM_PROPERTY_MAX + 1);
87178717

87188718
/* Initialize optional entries. */
8719-
for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++)
8719+
for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_MAX; i++)
87208720
ASET (item_properties, i, Qnil);
87218721
ASET (item_properties, ITEM_PROPERTY_ENABLE, Qt);
87228722

src/keyboard.h

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -294,26 +294,31 @@ extern Lisp_Object item_properties;
294294
/* This describes the elements of item_properties.
295295
The first element is not a property, it is a pointer to the item properties
296296
that is saved for GC protection. */
297-
#define ITEM_PROPERTY_ITEM 0
298-
/* The item string. */
299-
#define ITEM_PROPERTY_NAME 1
300-
/* Start of initialize to nil */
301-
/* The binding: nil, a command or a keymap. */
302-
#define ITEM_PROPERTY_DEF 2
303-
/* The keymap if the binding is a keymap, otherwise nil. */
304-
#define ITEM_PROPERTY_MAP 3
305-
/* Nil, :radio or :toggle. */
306-
#define ITEM_PROPERTY_TYPE 4
307-
/* Nil or a string describing an equivalent key binding. */
308-
#define ITEM_PROPERTY_KEYEQ 5
309-
/* Not nil if a selected toggle box or radio button, otherwise nil. */
310-
#define ITEM_PROPERTY_SELECTED 6
311-
/* Place for a help string. Not yet used. */
312-
#define ITEM_PROPERTY_HELP 7
313-
/* Start of initialize to t */
314-
/* Last property. */
315-
/* Not nil if item is enabled. */
316-
#define ITEM_PROPERTY_ENABLE 8
297+
enum item_property_idx
298+
{
299+
ITEM_PROPERTY_ITEM,
300+
/* The item string. */
301+
ITEM_PROPERTY_NAME,
302+
/* Start of initialize to nil */
303+
/* The binding: nil, a command or a keymap. */
304+
ITEM_PROPERTY_DEF,
305+
/* The keymap if the binding is a keymap, otherwise nil. */
306+
ITEM_PROPERTY_MAP,
307+
/* Nil, :radio or :toggle. */
308+
ITEM_PROPERTY_TYPE,
309+
/* Nil or a string describing an equivalent key binding. */
310+
ITEM_PROPERTY_KEYEQ,
311+
/* Not nil if a selected toggle box or radio button, otherwise nil. */
312+
ITEM_PROPERTY_SELECTED,
313+
/* Place for a help string. Not yet used. */
314+
ITEM_PROPERTY_HELP,
315+
/* Start of initialize to t */
316+
/* Last property. */
317+
/* Not nil if item is enabled. */
318+
ITEM_PROPERTY_ENABLE,
319+
/* Keep this equal to the highest member. */
320+
ITEM_PROPERTY_MAX = ITEM_PROPERTY_ENABLE
321+
};
317322

318323
/* This holds a Lisp vector that holds the results of decoding
319324
the keymaps or alist-of-alists that specify a menu.
@@ -352,9 +357,12 @@ extern int menu_items_used;
352357
excluding those within submenus. */
353358
extern int menu_items_n_panes;
354359

355-
#define MENU_ITEMS_PANE_NAME 1
356-
#define MENU_ITEMS_PANE_PREFIX 2
357-
#define MENU_ITEMS_PANE_LENGTH 3
360+
enum menu_item_pane_idx
361+
{
362+
MENU_ITEMS_PANE_NAME = 1,
363+
MENU_ITEMS_PANE_PREFIX = 2,
364+
MENU_ITEMS_PANE_LENGTH = 3,
365+
};
358366

359367
enum menu_item_idx
360368
{
@@ -370,9 +378,9 @@ enum menu_item_idx
370378
};
371379

372380
enum
373-
{
374-
KBD_BUFFER_SIZE = 4096
375-
};
381+
{
382+
KBD_BUFFER_SIZE = 4096
383+
};
376384

377385
extern void unuse_menu_items (void);
378386

0 commit comments

Comments
 (0)