aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2014-04-03 13:46:04 -0700
committerDaniel Colascione2014-04-03 13:46:04 -0700
commitc72d972c5dee96489a3fd881b239f3f7d0db2385 (patch)
treee2004a9d5ed96a27bf9f88a9bfe2b2c097245e29 /src
parent705cf384bec23354ad22a5c48d3430a96ef70ca1 (diff)
downloademacs-c72d972c5dee96489a3fd881b239f3f7d0db2385.tar.gz
emacs-c72d972c5dee96489a3fd881b239f3f7d0db2385.zip
Rename EARRAYSIZE to ARRAYELTS
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/alloc.c10
-rw-r--r--src/chartab.c4
-rw-r--r--src/dired.c2
-rw-r--r--src/dosfns.c4
-rw-r--r--src/emacs.c4
-rw-r--r--src/fileio.c2
-rw-r--r--src/frame.c8
-rw-r--r--src/fringe.c2
-rw-r--r--src/image.c2
-rw-r--r--src/keyboard.c30
-rw-r--r--src/lisp.h2
-rw-r--r--src/macfont.m12
-rw-r--r--src/msdos.c4
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsterm.m2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/term.c2
-rw-r--r--src/unexcw.c2
-rw-r--r--src/w32.c6
-rw-r--r--src/w32fns.c2
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.c2
24 files changed, 57 insertions, 57 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a628148bbda..b160668dc23 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,7 @@
12014-04-03 Daniel Colascione <dancol@dancol.org> 12014-04-03 Daniel Colascione <dancol@dancol.org>
2 2
3 In all places below, change expressions of the form sizeof(arr) / 3 In all places below, change expressions of the form sizeof(arr) /
4 sizeof(arr[0]) to EARRAYSIZE(arr). 4 sizeof(arr[0]) to ARRAYELTS(arr).
5 5
6 * xterm.c (x_term_init): See above. 6 * xterm.c (x_term_init): See above.
7 7
@@ -64,7 +64,7 @@
64 * data.c (Ffset): Abort if we're trying to set a function call to 64 * data.c (Ffset): Abort if we're trying to set a function call to
65 a dead lisp object. 65 a dead lisp object.
66 66
67 * lisp.h (EARRAYSIZE): New macro. 67 * lisp.h (ARRAYELTS): New macro.
68 68
69 * alloc.c: Include execinfo.h if available. 69 * alloc.c: Include execinfo.h if available.
70 (SUSPICIOUS_OBJECT_CHECKING): New macro; define unconditionally. 70 (SUSPICIOUS_OBJECT_CHECKING): New macro; define unconditionally.
diff --git a/src/alloc.c b/src/alloc.c
index 46b4f5021df..9740afe2ab8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6835,7 +6835,7 @@ find_suspicious_object_in_range (void* begin, void* end)
6835 char* end_a = end; 6835 char* end_a = end;
6836 int i; 6836 int i;
6837 6837
6838 for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) { 6838 for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) {
6839 char* suspicious_object = suspicious_objects[i]; 6839 char* suspicious_object = suspicious_objects[i];
6840 if (begin_a <= suspicious_object && suspicious_object < end_a) 6840 if (begin_a <= suspicious_object && suspicious_object < end_a)
6841 return suspicious_object; 6841 return suspicious_object;
@@ -6852,12 +6852,12 @@ detect_suspicious_free (void* ptr)
6852 6852
6853 eassert (ptr != NULL); 6853 eassert (ptr != NULL);
6854 6854
6855 for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) 6855 for (i = 0; i < ARRAYELTS (suspicious_objects); ++i)
6856 if (suspicious_objects[i] == ptr) 6856 if (suspicious_objects[i] == ptr)
6857 { 6857 {
6858 rec = &suspicious_free_history[suspicious_free_history_index++]; 6858 rec = &suspicious_free_history[suspicious_free_history_index++];
6859 if (suspicious_free_history_index == 6859 if (suspicious_free_history_index ==
6860 EARRAYSIZE (suspicious_free_history)) 6860 ARRAYELTS (suspicious_free_history))
6861 { 6861 {
6862 suspicious_free_history_index = 0; 6862 suspicious_free_history_index = 0;
6863 } 6863 }
@@ -6865,7 +6865,7 @@ detect_suspicious_free (void* ptr)
6865 memset (rec, 0, sizeof (*rec)); 6865 memset (rec, 0, sizeof (*rec));
6866 rec->suspicious_object = ptr; 6866 rec->suspicious_object = ptr;
6867#ifdef HAVE_EXECINFO_H 6867#ifdef HAVE_EXECINFO_H
6868 backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); 6868 backtrace (&rec->backtrace[0], ARRAYELTS (rec->backtrace));
6869#endif 6869#endif
6870 suspicious_objects[i] = NULL; 6870 suspicious_objects[i] = NULL;
6871 } 6871 }
@@ -6884,7 +6884,7 @@ garbage collection bugs. Otherwise, do nothing and return OBJ. */)
6884 /* Right now, we care only about vectors. */ 6884 /* Right now, we care only about vectors. */
6885 if (VECTORLIKEP (obj)) { 6885 if (VECTORLIKEP (obj)) {
6886 suspicious_objects[suspicious_object_index++] = XVECTOR (obj); 6886 suspicious_objects[suspicious_object_index++] = XVECTOR (obj);
6887 if (suspicious_object_index == EARRAYSIZE (suspicious_objects)) 6887 if (suspicious_object_index == ARRAYELTS (suspicious_objects))
6888 suspicious_object_index = 0; 6888 suspicious_object_index = 0;
6889 } 6889 }
6890#endif 6890#endif
diff --git a/src/chartab.c b/src/chartab.c
index 56a6f548749..4d4e6381b19 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1221,7 +1221,7 @@ uniprop_decode_value_run_length (Lisp_Object table, Lisp_Object value)
1221static uniprop_decoder_t uniprop_decoder [] = 1221static uniprop_decoder_t uniprop_decoder [] =
1222 { uniprop_decode_value_run_length }; 1222 { uniprop_decode_value_run_length };
1223 1223
1224static const int uniprop_decoder_count = EARRAYSIZE (uniprop_decoder); 1224static const int uniprop_decoder_count = ARRAYELTS (uniprop_decoder);
1225 1225
1226/* Return the decoder of char-table TABLE or nil if none. */ 1226/* Return the decoder of char-table TABLE or nil if none. */
1227 1227
@@ -1299,7 +1299,7 @@ static uniprop_encoder_t uniprop_encoder[] =
1299 uniprop_encode_value_run_length, 1299 uniprop_encode_value_run_length,
1300 uniprop_encode_value_numeric }; 1300 uniprop_encode_value_numeric };
1301 1301
1302static const int uniprop_encoder_count = EARRAYSIZE (uniprop_encoder); 1302static const int uniprop_encoder_count = ARRAYELTS (uniprop_encoder);
1303 1303
1304/* Return the encoder of char-table TABLE or nil if none. */ 1304/* Return the encoder of char-table TABLE or nil if none. */
1305 1305
diff --git a/src/dired.c b/src/dired.c
index 5d99314fde0..d8da45bf776 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -984,7 +984,7 @@ file_attributes (int fd, char const *name, Lisp_Object id_format)
984 values[10] = INTEGER_TO_CONS (s.st_ino); 984 values[10] = INTEGER_TO_CONS (s.st_ino);
985 values[11] = INTEGER_TO_CONS (s.st_dev); 985 values[11] = INTEGER_TO_CONS (s.st_dev);
986 986
987 return Flist (EARRAYSIZE (values), values); 987 return Flist (ARRAYELTS (values), values);
988} 988}
989 989
990DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, 990DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0,
diff --git a/src/dosfns.c b/src/dosfns.c
index b98e3cd8f29..baa0358d725 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -402,7 +402,7 @@ msdos_stdcolor_idx (const char *name)
402{ 402{
403 int i; 403 int i;
404 404
405 for (i = 0; i < EARRAYSIZE (vga_colors); i++) 405 for (i = 0; i < ARRAYELTS (vga_colors); i++)
406 if (xstrcasecmp (name, vga_colors[i]) == 0) 406 if (xstrcasecmp (name, vga_colors[i]) == 0)
407 return i; 407 return i;
408 408
@@ -422,7 +422,7 @@ msdos_stdcolor_name (int idx)
422 return build_string (unspecified_fg); 422 return build_string (unspecified_fg);
423 else if (idx == FACE_TTY_DEFAULT_BG_COLOR) 423 else if (idx == FACE_TTY_DEFAULT_BG_COLOR)
424 return build_string (unspecified_bg); 424 return build_string (unspecified_bg);
425 else if (idx >= 0 && idx < EARRAYSIZE (vga_colors)) 425 else if (idx >= 0 && idx < ARRAYELTS (vga_colors))
426 return build_string (vga_colors[idx]); 426 return build_string (vga_colors[idx]);
427 else 427 else
428 return Qunspecified; /* meaning the default */ 428 return Qunspecified; /* meaning the default */
diff --git a/src/emacs.c b/src/emacs.c
index a481a9c3d7f..75498dce50e 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1817,7 +1817,7 @@ sort_args (int argc, char **argv)
1817 } 1817 }
1818 1818
1819 /* Look for a match with a known old-fashioned option. */ 1819 /* Look for a match with a known old-fashioned option. */
1820 for (i = 0; i < EARRAYSIZE (standard_args); i++) 1820 for (i = 0; i < ARRAYELTS (standard_args); i++)
1821 if (!strcmp (argv[from], standard_args[i].name)) 1821 if (!strcmp (argv[from], standard_args[i].name))
1822 { 1822 {
1823 options[from] = standard_args[i].nargs; 1823 options[from] = standard_args[i].nargs;
@@ -1839,7 +1839,7 @@ sort_args (int argc, char **argv)
1839 1839
1840 match = -1; 1840 match = -1;
1841 1841
1842 for (i = 0; i < EARRAYSIZE (standard_args); i++) 1842 for (i = 0; i < ARRAYELTS (standard_args); i++)
1843 if (standard_args[i].longname 1843 if (standard_args[i].longname
1844 && !strncmp (argv[from], standard_args[i].longname, 1844 && !strncmp (argv[from], standard_args[i].longname,
1845 thislen)) 1845 thislen))
diff --git a/src/fileio.c b/src/fileio.c
index d317e169c26..5659b6555d8 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2909,7 +2909,7 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */)
2909 } 2909 }
2910#endif 2910#endif
2911 2911
2912 return Flist (EARRAYSIZE (values), values); 2912 return Flist (ARRAYELTS (values), values);
2913} 2913}
2914 2914
2915DEFUN ("set-file-selinux-context", Fset_file_selinux_context, 2915DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
diff --git a/src/frame.c b/src/frame.c
index 3784e998753..08d0efb6ea2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2867,7 +2867,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
2867 2867
2868 param_index = Fget (prop, Qx_frame_parameter); 2868 param_index = Fget (prop, Qx_frame_parameter);
2869 if (NATNUMP (param_index) 2869 if (NATNUMP (param_index)
2870 && XFASTINT (param_index) < EARRAYSIZE (frame_parms) 2870 && XFASTINT (param_index) < ARRAYELTS (frame_parms)
2871 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) 2871 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
2872 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); 2872 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
2873 } 2873 }
@@ -2915,7 +2915,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
2915 2915
2916 param_index = Fget (prop, Qx_frame_parameter); 2916 param_index = Fget (prop, Qx_frame_parameter);
2917 if (NATNUMP (param_index) 2917 if (NATNUMP (param_index)
2918 && XFASTINT (param_index) < EARRAYSIZE (frame_parms) 2918 && XFASTINT (param_index) < ARRAYELTS (frame_parms)
2919 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) 2919 && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
2920 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); 2920 (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
2921 } 2921 }
@@ -3226,7 +3226,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3226 { 3226 {
3227 Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); 3227 Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
3228 if (NATNUMP (parm_index) 3228 if (NATNUMP (parm_index)
3229 && XFASTINT (parm_index) < EARRAYSIZE (frame_parms) 3229 && XFASTINT (parm_index) < ARRAYELTS (frame_parms)
3230 && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) 3230 && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
3231 (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) 3231 (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)])
3232 (f, bgcolor, Qnil); 3232 (f, bgcolor, Qnil);
@@ -4560,7 +4560,7 @@ syms_of_frame (void)
4560 { 4560 {
4561 int i; 4561 int i;
4562 4562
4563 for (i = 0; i < EARRAYSIZE (frame_parms); i++) 4563 for (i = 0; i < ARRAYELTS (frame_parms); i++)
4564 { 4564 {
4565 Lisp_Object v = intern_c_string (frame_parms[i].name); 4565 Lisp_Object v = intern_c_string (frame_parms[i].name);
4566 if (frame_parms[i].variable) 4566 if (frame_parms[i].variable)
diff --git a/src/fringe.c b/src/fringe.c
index 1dd95341857..1eae6b18493 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -474,7 +474,7 @@ static struct fringe_bitmap standard_bitmaps[] =
474 474
475#define NO_FRINGE_BITMAP 0 475#define NO_FRINGE_BITMAP 0
476#define UNDEF_FRINGE_BITMAP 1 476#define UNDEF_FRINGE_BITMAP 1
477#define MAX_STANDARD_FRINGE_BITMAPS EARRAYSIZE (standard_bitmaps) 477#define MAX_STANDARD_FRINGE_BITMAPS ARRAYELTS (standard_bitmaps)
478 478
479static struct fringe_bitmap **fringe_bitmaps; 479static struct fringe_bitmap **fringe_bitmaps;
480static Lisp_Object *fringe_faces; 480static Lisp_Object *fringe_faces;
diff --git a/src/image.c b/src/image.c
index 64bd41b52ab..bfbdfbc86b2 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3955,7 +3955,7 @@ xpm_str_to_color_key (const char *s)
3955{ 3955{
3956 int i; 3956 int i;
3957 3957
3958 for (i = 0; i < EARRAYSIZE (xpm_color_key_strings); i++) 3958 for (i = 0; i < ARRAYELTS (xpm_color_key_strings); i++)
3959 if (strcmp (xpm_color_key_strings[i], s) == 0) 3959 if (strcmp (xpm_color_key_strings[i], s) == 0)
3960 return i; 3960 return i;
3961 return -1; 3961 return -1;
diff --git a/src/keyboard.c b/src/keyboard.c
index ccdb469bbb3..6de537085fe 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1446,7 +1446,7 @@ command_loop_1 (void)
1446 Vthis_command_keys_shift_translated = Qnil; 1446 Vthis_command_keys_shift_translated = Qnil;
1447 1447
1448 /* Read next key sequence; i gets its length. */ 1448 /* Read next key sequence; i gets its length. */
1449 i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), 1449 i = read_key_sequence (keybuf, ARRAYELTS (keybuf),
1450 Qnil, 0, 1, 1, 0); 1450 Qnil, 0, 1, 1, 0);
1451 1451
1452 /* A filter may have run while we were reading the input. */ 1452 /* A filter may have run while we were reading the input. */
@@ -1694,7 +1694,7 @@ read_menu_command (void)
1694 menus. */ 1694 menus. */
1695 specbind (Qecho_keystrokes, make_number (0)); 1695 specbind (Qecho_keystrokes, make_number (0));
1696 1696
1697 i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), 1697 i = read_key_sequence (keybuf, ARRAYELTS (keybuf),
1698 Qnil, 0, 1, 1, 1); 1698 Qnil, 0, 1, 1, 1);
1699 1699
1700 unbind_to (count, Qnil); 1700 unbind_to (count, Qnil);
@@ -5484,7 +5484,7 @@ make_lispy_event (struct input_event *event)
5484 event->modifiers, 5484 event->modifiers,
5485 Qfunction_key, Qnil, 5485 Qfunction_key, Qnil,
5486 lispy_accent_keys, &accent_key_syms, 5486 lispy_accent_keys, &accent_key_syms,
5487 EARRAYSIZE (lispy_accent_keys)); 5487 ARRAYELTS (lispy_accent_keys));
5488 5488
5489#if 0 5489#if 0
5490#ifdef XK_kana_A 5490#ifdef XK_kana_A
@@ -5493,7 +5493,7 @@ make_lispy_event (struct input_event *event)
5493 event->modifiers & ~shift_modifier, 5493 event->modifiers & ~shift_modifier,
5494 Qfunction_key, Qnil, 5494 Qfunction_key, Qnil,
5495 lispy_kana_keys, &func_key_syms, 5495 lispy_kana_keys, &func_key_syms,
5496 EARRAYSIZE (lispy_kana_keys)); 5496 ARRAYELTS (lispy_kana_keys));
5497#endif /* XK_kana_A */ 5497#endif /* XK_kana_A */
5498#endif /* 0 */ 5498#endif /* 0 */
5499 5499
@@ -5504,7 +5504,7 @@ make_lispy_event (struct input_event *event)
5504 event->modifiers, 5504 event->modifiers,
5505 Qfunction_key, Qnil, 5505 Qfunction_key, Qnil,
5506 iso_lispy_function_keys, &func_key_syms, 5506 iso_lispy_function_keys, &func_key_syms,
5507 EARRAYSIZE (iso_lispy_function_keys)); 5507 ARRAYELTS (iso_lispy_function_keys));
5508#endif 5508#endif
5509 5509
5510 /* Handle system-specific or unknown keysyms. */ 5510 /* Handle system-specific or unknown keysyms. */
@@ -5530,17 +5530,17 @@ make_lispy_event (struct input_event *event)
5530 event->modifiers, 5530 event->modifiers,
5531 Qfunction_key, Qnil, 5531 Qfunction_key, Qnil,
5532 lispy_function_keys, &func_key_syms, 5532 lispy_function_keys, &func_key_syms,
5533 EARRAYSIZE (lispy_function_keys)); 5533 ARRAYELTS (lispy_function_keys));
5534 5534
5535#ifdef HAVE_NTGUI 5535#ifdef HAVE_NTGUI
5536 case MULTIMEDIA_KEY_EVENT: 5536 case MULTIMEDIA_KEY_EVENT:
5537 if (event->code < EARRAYSIZE (lispy_multimedia_keys) 5537 if (event->code < ARRAYELTS (lispy_multimedia_keys)
5538 && event->code > 0 && lispy_multimedia_keys[event->code]) 5538 && event->code > 0 && lispy_multimedia_keys[event->code])
5539 { 5539 {
5540 return modify_event_symbol (event->code, event->modifiers, 5540 return modify_event_symbol (event->code, event->modifiers,
5541 Qfunction_key, Qnil, 5541 Qfunction_key, Qnil,
5542 lispy_multimedia_keys, &func_key_syms, 5542 lispy_multimedia_keys, &func_key_syms,
5543 EARRAYSIZE (lispy_multimedia_keys)); 5543 ARRAYELTS (lispy_multimedia_keys));
5544 } 5544 }
5545 return Qnil; 5545 return Qnil;
5546#endif 5546#endif
@@ -6262,7 +6262,7 @@ static const char *const modifier_names[] =
6262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6263 0, 0, "alt", "super", "hyper", "shift", "control", "meta" 6263 0, 0, "alt", "super", "hyper", "shift", "control", "meta"
6264}; 6264};
6265#define NUM_MOD_NAMES EARRAYSIZE (modifier_names) 6265#define NUM_MOD_NAMES ARRAYELTS (modifier_names)
6266 6266
6267static Lisp_Object modifier_symbols; 6267static Lisp_Object modifier_symbols;
6268 6268
@@ -9752,7 +9752,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object continue_echo,
9752 9752
9753 memset (keybuf, 0, sizeof keybuf); 9753 memset (keybuf, 0, sizeof keybuf);
9754 GCPRO1 (keybuf[0]); 9754 GCPRO1 (keybuf[0]);
9755 gcpro1.nvars = EARRAYSIZE (keybuf); 9755 gcpro1.nvars = ARRAYELTS (keybuf);
9756 9756
9757 if (NILP (continue_echo)) 9757 if (NILP (continue_echo))
9758 { 9758 {
@@ -9766,7 +9766,7 @@ read_key_sequence_vs (Lisp_Object prompt, Lisp_Object continue_echo,
9766 cancel_hourglass (); 9766 cancel_hourglass ();
9767#endif 9767#endif
9768 9768
9769 i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), 9769 i = read_key_sequence (keybuf, ARRAYELTS (keybuf),
9770 prompt, ! NILP (dont_downcase_last), 9770 prompt, ! NILP (dont_downcase_last),
9771 ! NILP (can_return_switch_frame), 0, 0); 9771 ! NILP (can_return_switch_frame), 0, 0);
9772 9772
@@ -10669,7 +10669,7 @@ The elements of this list correspond to the arguments of
10669 } 10669 }
10670 XSETFASTINT (val[3], quit_char); 10670 XSETFASTINT (val[3], quit_char);
10671 10671
10672 return Flist (EARRAYSIZE (val), val); 10672 return Flist (ARRAYELTS (val), val);
10673} 10673}
10674 10674
10675DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0, 10675DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0,
@@ -11037,7 +11037,7 @@ syms_of_keyboard (void)
11037 11037
11038 { 11038 {
11039 int i; 11039 int i;
11040 int len = EARRAYSIZE (head_table); 11040 int len = ARRAYELTS (head_table);
11041 11041
11042 for (i = 0; i < len; i++) 11042 for (i = 0; i < len; i++)
11043 { 11043 {
@@ -11053,13 +11053,13 @@ syms_of_keyboard (void)
11053 staticpro (&button_down_location); 11053 staticpro (&button_down_location);
11054 mouse_syms = Fmake_vector (make_number (5), Qnil); 11054 mouse_syms = Fmake_vector (make_number (5), Qnil);
11055 staticpro (&mouse_syms); 11055 staticpro (&mouse_syms);
11056 wheel_syms = Fmake_vector (make_number (EARRAYSIZE (lispy_wheel_names)), 11056 wheel_syms = Fmake_vector (make_number (ARRAYELTS (lispy_wheel_names)),
11057 Qnil); 11057 Qnil);
11058 staticpro (&wheel_syms); 11058 staticpro (&wheel_syms);
11059 11059
11060 { 11060 {
11061 int i; 11061 int i;
11062 int len = EARRAYSIZE (modifier_names); 11062 int len = ARRAYELTS (modifier_names);
11063 11063
11064 modifier_symbols = Fmake_vector (make_number (len), Qnil); 11064 modifier_symbols = Fmake_vector (make_number (len), Qnil);
11065 for (i = 0; i < len; i++) 11065 for (i = 0; i < len; i++)
diff --git a/src/lisp.h b/src/lisp.h
index b8c909ab60d..a697e39a204 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -59,7 +59,7 @@ INLINE_HEADER_BEGIN
59#define min(a, b) ((a) < (b) ? (a) : (b)) 59#define min(a, b) ((a) < (b) ? (a) : (b))
60 60
61/* Find number of elements in array */ 61/* Find number of elements in array */
62#define EARRAYSIZE(arr) (sizeof (arr) / sizeof ((arr)[0])) 62#define ARRAYELTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
63 63
64/* EMACS_INT - signed integer wide enough to hold an Emacs value 64/* EMACS_INT - signed integer wide enough to hold an Emacs value
65 EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if 65 EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if
diff --git a/src/macfont.m b/src/macfont.m
index 447b08c723d..7aa1d40b332 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -237,7 +237,7 @@ mac_font_get_glyph_for_cid (FontRef font, CharacterCollection collection,
237 unichar characters[] = {0xfffd}; 237 unichar characters[] = {0xfffd};
238 NSString *string = 238 NSString *string =
239 [NSString stringWithCharacters:characters 239 [NSString stringWithCharacters:characters
240 length:EARRAYSIZE (characters)]; 240 length:ARRAYELTS (characters)];
241 NSGlyphInfo *glyphInfo = 241 NSGlyphInfo *glyphInfo =
242 [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid 242 [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid
243 collection:collection 243 collection:collection
@@ -825,7 +825,7 @@ macfont_store_descriptor_attributes (FontDescriptorRef desc,
825 {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; 825 {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}};
826 int i; 826 int i;
827 827
828 for (i = 0; i < EARRAYSIZE (numeric_traits); i++) 828 for (i = 0; i < ARRAYELTS (numeric_traits); i++)
829 { 829 {
830 num = CFDictionaryGetValue (dict, numeric_traits[i].trait); 830 num = CFDictionaryGetValue (dict, numeric_traits[i].trait);
831 if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) 831 if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval))
@@ -1907,7 +1907,7 @@ macfont_create_attributes_with_spec (Lisp_Object spec)
1907 if (! traits) 1907 if (! traits)
1908 goto err; 1908 goto err;
1909 1909
1910 for (i = 0; i < EARRAYSIZE (numeric_traits); i++) 1910 for (i = 0; i < ARRAYELTS (numeric_traits); i++)
1911 { 1911 {
1912 tmp = AREF (spec, numeric_traits[i].index); 1912 tmp = AREF (spec, numeric_traits[i].index);
1913 if (INTEGERP (tmp)) 1913 if (INTEGERP (tmp))
@@ -3583,7 +3583,7 @@ mac_ctfont_create_line_with_string_and_font (CFStringRef string,
3583 { 3583 {
3584 attributes = CFDictionaryCreate (NULL, (const void **) keys, 3584 attributes = CFDictionaryCreate (NULL, (const void **) keys,
3585 (const void **) values, 3585 (const void **) values,
3586 EARRAYSIZE (keys), 3586 ARRAYELTS (keys),
3587 &kCFTypeDictionaryKeyCallBacks, 3587 &kCFTypeDictionaryKeyCallBacks,
3588 &kCFTypeDictionaryValueCallBacks); 3588 &kCFTypeDictionaryValueCallBacks);
3589 CFRelease (values[1]); 3589 CFRelease (values[1]);
@@ -3794,7 +3794,7 @@ mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection,
3794 CTLineRef ctline = NULL; 3794 CTLineRef ctline = NULL;
3795 3795
3796 string = CFStringCreateWithCharacters (NULL, characters, 3796 string = CFStringCreateWithCharacters (NULL, characters,
3797 EARRAYSIZE (characters)); 3797 ARRAYELTS (characters));
3798 3798
3799 if (string) 3799 if (string)
3800 { 3800 {
@@ -3810,7 +3810,7 @@ mac_ctfont_get_glyph_for_cid (CTFontRef font, CTCharacterCollection collection,
3810 3810
3811 attributes = CFDictionaryCreate (NULL, (const void **) keys, 3811 attributes = CFDictionaryCreate (NULL, (const void **) keys,
3812 (const void **) values, 3812 (const void **) values,
3813 EARRAYSIZE (keys), 3813 ARRAYELTS (keys),
3814 &kCFTypeDictionaryKeyCallBacks, 3814 &kCFTypeDictionaryKeyCallBacks,
3815 &kCFTypeDictionaryValueCallBacks); 3815 &kCFTypeDictionaryValueCallBacks);
3816 CFRelease (glyph_info); 3816 CFRelease (glyph_info);
diff --git a/src/msdos.c b/src/msdos.c
index 2b636977f61..6b677bb2f02 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -564,7 +564,7 @@ dos_set_window_size (int *rows, int *cols)
564 }; 564 };
565 int i = 0; 565 int i = 0;
566 566
567 while (i < EARRAYSIZE (std_dimension)) 567 while (i < ARRAYELTS (std_dimension))
568 { 568 {
569 if (std_dimension[i].need_vga <= have_vga 569 if (std_dimension[i].need_vga <= have_vga
570 && std_dimension[i].rows >= *rows) 570 && std_dimension[i].rows >= *rows)
@@ -3465,7 +3465,7 @@ init_environment (int argc, char **argv, int skip_args)
3465 static const char * const tempdirs[] = { 3465 static const char * const tempdirs[] = {
3466 "$TMPDIR", "$TEMP", "$TMP", "c:/" 3466 "$TMPDIR", "$TEMP", "$TMP", "c:/"
3467 }; 3467 };
3468 const int imax = EARRAYSIZE (tempdirs); 3468 const int imax = ARRAYELTS (tempdirs);
3469 3469
3470 /* Make sure they have a usable $TMPDIR. Many Emacs functions use 3470 /* Make sure they have a usable $TMPDIR. Many Emacs functions use
3471 temporary files and assume "/tmp" if $TMPDIR is unset, which 3471 temporary files and assume "/tmp" if $TMPDIR is unset, which
diff --git a/src/nsfns.m b/src/nsfns.m
index d1692915bc7..4c3f7f34c07 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1024,7 +1024,7 @@ get_geometry_from_preferences (struct ns_display_info *dpyinfo,
1024 }; 1024 };
1025 1025
1026 int i; 1026 int i;
1027 for (i = 0; i < EARRAYSIZE (r); ++i) 1027 for (i = 0; i < ARRAYELTS (r); ++i)
1028 { 1028 {
1029 if (NILP (Fassq (r[i].tem, parms))) 1029 if (NILP (Fassq (r[i].tem, parms)))
1030 { 1030 {
diff --git a/src/nsterm.m b/src/nsterm.m
index fb4d4028140..842ff194c40 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2012,7 +2012,7 @@ ns_convert_key (unsigned code)
2012 Internal call used by NSView-keyDown. 2012 Internal call used by NSView-keyDown.
2013 -------------------------------------------------------------------------- */ 2013 -------------------------------------------------------------------------- */
2014{ 2014{
2015 const unsigned last_keysym = EARRAYSIZE (convert_ns_to_X_keysym); 2015 const unsigned last_keysym = ARRAYELTS (convert_ns_to_X_keysym);
2016 unsigned keysym; 2016 unsigned keysym;
2017 /* An array would be faster, but less easy to read. */ 2017 /* An array would be faster, but less easy to read. */
2018 for (keysym = 0; keysym < last_keysym; keysym += 2) 2018 for (keysym = 0; keysym < last_keysym; keysym += 2)
diff --git a/src/sysdep.c b/src/sysdep.c
index f1608c4ab21..964dc419d25 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -255,7 +255,7 @@ init_baud_rate (int fd)
255#endif /* not DOS_NT */ 255#endif /* not DOS_NT */
256 } 256 }
257 257
258 baud_rate = (emacs_ospeed < EARRAYSIZE (baud_convert) 258 baud_rate = (emacs_ospeed < ARRAYELTS (baud_convert)
259 ? baud_convert[emacs_ospeed] : 9600); 259 ? baud_convert[emacs_ospeed] : 9600);
260 if (baud_rate == 0) 260 if (baud_rate == 0)
261 baud_rate = 1200; 261 baud_rate = 1200;
diff --git a/src/term.c b/src/term.c
index 600c16ba820..6512f12fcab 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1339,7 +1339,7 @@ term_get_fkeys_1 (void)
1339 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) 1339 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
1340 kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil)); 1340 kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
1341 1341
1342 for (i = 0; i < EARRAYSIZE (keys); i++) 1342 for (i = 0; i < ARRAYELTS (keys); i++)
1343 { 1343 {
1344 char *sequence = tgetstr (keys[i].cap, address); 1344 char *sequence = tgetstr (keys[i].cap, address);
1345 if (sequence) 1345 if (sequence)
diff --git a/src/unexcw.c b/src/unexcw.c
index 1809961a801..7636b05a12e 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -81,7 +81,7 @@ read_exe_header (int fd, exe_header_t * exe_header_buffer)
81#endif 81#endif
82 assert (exe_header_buffer->file_header.f_nscns > 0); 82 assert (exe_header_buffer->file_header.f_nscns > 0);
83 assert (exe_header_buffer->file_header.f_nscns <= 83 assert (exe_header_buffer->file_header.f_nscns <=
84 EARRAYSIZE (exe_header_buffer->section_header)); 84 ARRAYELTS (exe_header_buffer->section_header));
85 assert (exe_header_buffer->file_header.f_opthdr > 0); 85 assert (exe_header_buffer->file_header.f_opthdr > 0);
86 86
87 ret = 87 ret =
diff --git a/src/w32.c b/src/w32.c
index e0fd60b1d20..ca7d1869b6f 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1707,7 +1707,7 @@ static unsigned num_of_processors;
1707/* We maintain 1-sec samples for the last 16 minutes in a circular buffer. */ 1707/* We maintain 1-sec samples for the last 16 minutes in a circular buffer. */
1708static struct load_sample samples[16*60]; 1708static struct load_sample samples[16*60];
1709static int first_idx = -1, last_idx = -1; 1709static int first_idx = -1, last_idx = -1;
1710static int max_idx = EARRAYSIZE (samples); 1710static int max_idx = ARRAYELTS (samples);
1711 1711
1712static int 1712static int
1713buf_next (int from) 1713buf_next (int from)
@@ -2511,7 +2511,7 @@ init_environment (char ** argv)
2511 2511
2512 int i; 2512 int i;
2513 2513
2514 const int imax = EARRAYSIZE (tempdirs); 2514 const int imax = ARRAYELTS (tempdirs);
2515 2515
2516 /* Implementation note: This function explicitly works with ANSI 2516 /* Implementation note: This function explicitly works with ANSI
2517 file names, not with UTF-8 encoded file names. This is because 2517 file names, not with UTF-8 encoded file names. This is because
@@ -2584,7 +2584,7 @@ init_environment (char ** argv)
2584 {"LANG", NULL}, 2584 {"LANG", NULL},
2585 }; 2585 };
2586 2586
2587#define N_ENV_VARS EARRAYSIZE (dflt_envvars) 2587#define N_ENV_VARS ARRAYELTS (dflt_envvars)
2588 2588
2589 /* We need to copy dflt_envvars[] and work on the copy because we 2589 /* We need to copy dflt_envvars[] and work on the copy because we
2590 don't want the dumped Emacs to inherit the values of 2590 don't want the dumped Emacs to inherit the values of
diff --git a/src/w32fns.c b/src/w32fns.c
index 3c366022770..77476757c2f 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -723,7 +723,7 @@ w32_default_color_map (void)
723 723
724 cmap = Qnil; 724 cmap = Qnil;
725 725
726 for (i = 0; i < EARRAYSIZE (w32_color_map); pc++, i++) 726 for (i = 0; i < ARRAYELTS (w32_color_map); pc++, i++)
727 cmap = Fcons (Fcons (build_string (pc->name), 727 cmap = Fcons (Fcons (build_string (pc->name),
728 make_number (pc->colorref)), 728 make_number (pc->colorref)),
729 cmap); 729 cmap);
diff --git a/src/xfaces.c b/src/xfaces.c
index bae315b2811..7a630704fc9 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -515,7 +515,7 @@ DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0,
515 515
516 fputc ('\n', stderr); 516 fputc ('\n', stderr);
517 517
518 for (i = n = 0; i < EARRAYSIZE (color_count); ++i) 518 for (i = n = 0; i < ARRAYELTS (color_count); ++i)
519 if (color_count[i]) 519 if (color_count[i])
520 { 520 {
521 fprintf (stderr, "%3d: %5d", i, color_count[i]); 521 fprintf (stderr, "%3d: %5d", i, color_count[i]);
diff --git a/src/xfns.c b/src/xfns.c
index ef827b55252..13b4c6e7879 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1944,7 +1944,7 @@ static XIMStyle
1944best_xim_style (XIMStyles *xim) 1944best_xim_style (XIMStyles *xim)
1945{ 1945{
1946 int i, j; 1946 int i, j;
1947 int nr_supported = EARRAYSIZE (supported_xim_styles); 1947 int nr_supported = ARRAYELTS (supported_xim_styles);
1948 1948
1949 for (i = 0; i < nr_supported; ++i) 1949 for (i = 0; i < nr_supported; ++i)
1950 for (j = 0; j < xim->count_styles; ++j) 1950 for (j = 0; j < xim->count_styles; ++j)
diff --git a/src/xterm.c b/src/xterm.c
index ee8fce047de..a04f2fef055 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10103,7 +10103,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10103 }; 10103 };
10104 10104
10105 int i; 10105 int i;
10106 const int atom_count = EARRAYSIZE (atom_refs); 10106 const int atom_count = ARRAYELTS (atom_refs);
10107 /* 1 for _XSETTINGS_SN */ 10107 /* 1 for _XSETTINGS_SN */
10108 const int total_atom_count = 1 + atom_count; 10108 const int total_atom_count = 1 + atom_count;
10109 Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return); 10109 Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return);