aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-03-04 00:00:39 -0800
committerPaul Eggert2019-03-04 00:05:04 -0800
commit5c2563a5472cd5580e7af570aa320ac581ad1985 (patch)
treefbf88ede49dc0ba527d3925dfc274c230b8cf95f /src
parentd6b3e5bbc5e14c32f3faad9f1481ec16807ac2fe (diff)
downloademacs-5c2563a5472cd5580e7af570aa320ac581ad1985.tar.gz
emacs-5c2563a5472cd5580e7af570aa320ac581ad1985.zip
Simplify list creation in C code
The main new thing here is that C code can now say ‘list (a, b, c, d, e, f)’ instead of ‘listn (CONSTYPE_HEAP, 6, a, b, c, d, e, f)’, thus relieving callers of the responsibility of counting arguments (plus, the code feels more like Lisp). The old list1 ... list5 functions remain, as they’re probably a bit faster for small lists. * src/alloc.c (cons_listn, pure_listn): New functions. (listn): Omit enum argument. All callers changed to use either new ‘list’ or ‘pure_list’ macros. * src/charset.c (Fdefine_charset_internal): * src/coding.c (detect_coding_system) (Fset_terminal_coding_system_internal): * src/frame.c (frame_size_history_add, adjust_frame_size): * src/gtkutil.c (xg_frame_set_char_size): * src/keyboard.c (command_loop_1): * src/nsfns.m (frame_geometry): * src/widget.c (set_frame_size): * src/xfaces.c (Fcolor_distance): * src/xfns.c (frame_geometry): * src/xterm.c (x_set_window_size_1): * src/xwidget.c (Fxwidget_size_request): Prefer list1i, list2i, etc. to open-coding them. * src/charset.c (Fset_charset_priority): * src/nsterm.m (append2): * src/window.c (window_list): * src/xfaces.c (Fx_list_fonts): Use nconc2 instead of open-coding it. * src/eval.c (eval_sub, backtrace_frame_apply): * src/kqueue.c (kqueue_generate_event): * src/nsterm.m (performDragOperation:): * src/pdumper.c (Fpdumper_stats): * src/w32.c (init_environment): Prefer list1, list2, etc. to open-coding them. * src/font.c (font_list_entities): Parenthesize to avoid expanding new ‘list’ macro. * src/gtkutil.c (GETSETUP): Rename from MAKE_FLOAT_PAGE_SETUP to get lines to fit. Move outside the ‘list’ call, since it’s now a macro. * src/keymap.c (Fmake_keymap): Simplify. * src/lisp.h (list, pure_list): New macros. (list1i): New function.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c56
-rw-r--r--src/buffer.c2
-rw-r--r--src/callint.c9
-rw-r--r--src/charset.c15
-rw-r--r--src/coding.c22
-rw-r--r--src/emacs-module.c18
-rw-r--r--src/eval.c4
-rw-r--r--src/fns.c8
-rw-r--r--src/font.c2
-rw-r--r--src/frame.c10
-rw-r--r--src/gnutls.c6
-rw-r--r--src/gtkutil.c33
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.c34
-rw-r--r--src/kqueue.c2
-rw-r--r--src/lisp.h16
-rw-r--r--src/nsfns.m23
-rw-r--r--src/nsterm.m6
-rw-r--r--src/pdumper.c3
-rw-r--r--src/search.c7
-rw-r--r--src/syntax.c2
-rw-r--r--src/w32.c3
-rw-r--r--src/w32cygwinx.c3
-rw-r--r--src/w32fns.c5
-rw-r--r--src/widget.c2
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfaces.c10
-rw-r--r--src/xfns.c14
-rw-r--r--src/xterm.c13
-rw-r--r--src/xwidget.c3
31 files changed, 158 insertions, 191 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 6b366485550..02c55f8ce4c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2864,50 +2864,57 @@ list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
2864 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil))); 2864 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil)));
2865} 2865}
2866 2866
2867
2868Lisp_Object 2867Lisp_Object
2869list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4) 2868list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4)
2870{ 2869{
2871 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil)))); 2870 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil))));
2872} 2871}
2873 2872
2874
2875Lisp_Object 2873Lisp_Object
2876list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5) 2874list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4,
2875 Lisp_Object arg5)
2877{ 2876{
2878 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, 2877 return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4,
2879 Fcons (arg5, Qnil))))); 2878 Fcons (arg5, Qnil)))));
2880} 2879}
2881 2880
2882/* Make a list of COUNT Lisp_Objects, where ARG is the 2881/* Make a list of COUNT Lisp_Objects, where ARG is the first one.
2883 first one. Allocate conses from pure space if TYPE 2882 Use CONS to construct the pairs. AP has any remaining args. */
2884 is CONSTYPE_PURE, or allocate as usual if type is CONSTYPE_HEAP. */ 2883static Lisp_Object
2885 2884cons_listn (ptrdiff_t count, Lisp_Object arg,
2886Lisp_Object 2885 Lisp_Object (*cons) (Lisp_Object, Lisp_Object), va_list ap)
2887listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
2888{ 2886{
2889 Lisp_Object (*cons) (Lisp_Object, Lisp_Object);
2890 switch (type)
2891 {
2892 case CONSTYPE_PURE: cons = pure_cons; break;
2893 case CONSTYPE_HEAP: cons = Fcons; break;
2894 default: emacs_abort ();
2895 }
2896
2897 eassume (0 < count); 2887 eassume (0 < count);
2898 Lisp_Object val = cons (arg, Qnil); 2888 Lisp_Object val = cons (arg, Qnil);
2899 Lisp_Object tail = val; 2889 Lisp_Object tail = val;
2900
2901 va_list ap;
2902 va_start (ap, arg);
2903 for (ptrdiff_t i = 1; i < count; i++) 2890 for (ptrdiff_t i = 1; i < count; i++)
2904 { 2891 {
2905 Lisp_Object elem = cons (va_arg (ap, Lisp_Object), Qnil); 2892 Lisp_Object elem = cons (va_arg (ap, Lisp_Object), Qnil);
2906 XSETCDR (tail, elem); 2893 XSETCDR (tail, elem);
2907 tail = elem; 2894 tail = elem;
2908 } 2895 }
2896 return val;
2897}
2898
2899/* Make a list of COUNT Lisp_Objects, where ARG1 is the first one. */
2900Lisp_Object
2901listn (ptrdiff_t count, Lisp_Object arg1, ...)
2902{
2903 va_list ap;
2904 va_start (ap, arg1);
2905 Lisp_Object val = cons_listn (count, arg1, Fcons, ap);
2909 va_end (ap); 2906 va_end (ap);
2907 return val;
2908}
2910 2909
2910/* Make a pure list of COUNT Lisp_Objects, where ARG1 is the first one. */
2911Lisp_Object
2912pure_listn (ptrdiff_t count, Lisp_Object arg1, ...)
2913{
2914 va_list ap;
2915 va_start (ap, arg1);
2916 Lisp_Object val = cons_listn (count, arg1, pure_cons, ap);
2917 va_end (ap);
2911 return val; 2918 return val;
2912} 2919}
2913 2920
@@ -7283,8 +7290,7 @@ Frames, windows, buffers, and subprocesses count as vectors
7283 (but the contents of a buffer's text do not count here). */) 7290 (but the contents of a buffer's text do not count here). */)
7284 (void) 7291 (void)
7285{ 7292{
7286 return listn (CONSTYPE_HEAP, 7, 7293 return list (make_int (cons_cells_consed),
7287 make_int (cons_cells_consed),
7288 make_int (floats_consed), 7294 make_int (floats_consed),
7289 make_int (vector_cells_consed), 7295 make_int (vector_cells_consed),
7290 make_int (symbols_consed), 7296 make_int (symbols_consed),
@@ -7584,8 +7590,10 @@ do hash-consing of the objects allocated to pure space. */);
7584 /* We build this in advance because if we wait until we need it, we might 7590 /* We build this in advance because if we wait until we need it, we might
7585 not be able to allocate the memory to hold it. */ 7591 not be able to allocate the memory to hold it. */
7586 Vmemory_signal_data 7592 Vmemory_signal_data
7587 = listn (CONSTYPE_PURE, 2, Qerror, 7593 = pure_list (Qerror,
7588 build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs")); 7594 build_pure_c_string ("Memory exhausted--use"
7595 " M-x save-some-buffers then"
7596 " exit and restart Emacs"));
7589 7597
7590 DEFVAR_LISP ("memory-full", Vmemory_full, 7598 DEFVAR_LISP ("memory-full", Vmemory_full,
7591 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); 7599 doc: /* Non-nil means Emacs cannot get much more Lisp memory. */);
diff --git a/src/buffer.c b/src/buffer.c
index e5cc5f367f0..44b33f5b60d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5487,7 +5487,7 @@ syms_of_buffer (void)
5487 Qoverwrite_mode_binary)); 5487 Qoverwrite_mode_binary));
5488 5488
5489 Fput (Qprotected_field, Qerror_conditions, 5489 Fput (Qprotected_field, Qerror_conditions,
5490 listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror)); 5490 pure_list (Qprotected_field, Qerror));
5491 Fput (Qprotected_field, Qerror_message, 5491 Fput (Qprotected_field, Qerror_message,
5492 build_pure_c_string ("Attempt to modify a protected field")); 5492 build_pure_c_string ("Attempt to modify a protected field"));
5493 5493
diff --git a/src/callint.c b/src/callint.c
index ba6e3350a50..9993e732fb4 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -814,11 +814,10 @@ syms_of_callint (void)
814 callint_message = Qnil; 814 callint_message = Qnil;
815 staticpro (&callint_message); 815 staticpro (&callint_message);
816 816
817 preserved_fns = listn (CONSTYPE_PURE, 4, 817 preserved_fns = pure_list (intern_c_string ("region-beginning"),
818 intern_c_string ("region-beginning"), 818 intern_c_string ("region-end"),
819 intern_c_string ("region-end"), 819 intern_c_string ("point"),
820 intern_c_string ("point"), 820 intern_c_string ("mark"));
821 intern_c_string ("mark"));
822 staticpro (&preserved_fns); 821 staticpro (&preserved_fns);
823 822
824 DEFSYM (Qlist, "list"); 823 DEFSYM (Qlist, "list");
diff --git a/src/charset.c b/src/charset.c
index 7e2e657c7fc..56ab8d70181 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1175,8 +1175,7 @@ usage: (define-charset-internal ...) */)
1175 ISO_CHARSET_TABLE (charset.dimension, charset.iso_chars_96, 1175 ISO_CHARSET_TABLE (charset.dimension, charset.iso_chars_96,
1176 charset.iso_final) = id; 1176 charset.iso_final) = id;
1177 if (new_definition_p) 1177 if (new_definition_p)
1178 Viso_2022_charset_list = nconc2 (Viso_2022_charset_list, 1178 Viso_2022_charset_list = nconc2 (Viso_2022_charset_list, list1i (id));
1179 list1 (make_fixnum (id)));
1180 if (ISO_CHARSET_TABLE (1, 0, 'J') == id) 1179 if (ISO_CHARSET_TABLE (1, 0, 'J') == id)
1181 charset_jisx0201_roman = id; 1180 charset_jisx0201_roman = id;
1182 else if (ISO_CHARSET_TABLE (2, 0, '@') == id) 1181 else if (ISO_CHARSET_TABLE (2, 0, '@') == id)
@@ -1196,15 +1195,14 @@ usage: (define-charset-internal ...) */)
1196 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 2; 1195 emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 2;
1197 if (new_definition_p) 1196 if (new_definition_p)
1198 Vemacs_mule_charset_list = nconc2 (Vemacs_mule_charset_list, 1197 Vemacs_mule_charset_list = nconc2 (Vemacs_mule_charset_list,
1199 list1 (make_fixnum (id))); 1198 list1i (id));
1200 } 1199 }
1201 1200
1202 if (new_definition_p) 1201 if (new_definition_p)
1203 { 1202 {
1204 Vcharset_list = Fcons (args[charset_arg_name], Vcharset_list); 1203 Vcharset_list = Fcons (args[charset_arg_name], Vcharset_list);
1205 if (charset.supplementary_p) 1204 if (charset.supplementary_p)
1206 Vcharset_ordered_list = nconc2 (Vcharset_ordered_list, 1205 Vcharset_ordered_list = nconc2 (Vcharset_ordered_list, list1i (id));
1207 list1 (make_fixnum (id)));
1208 else 1206 else
1209 { 1207 {
1210 Lisp_Object tail; 1208 Lisp_Object tail;
@@ -1221,7 +1219,7 @@ usage: (define-charset-internal ...) */)
1221 Vcharset_ordered_list); 1219 Vcharset_ordered_list);
1222 else if (NILP (tail)) 1220 else if (NILP (tail))
1223 Vcharset_ordered_list = nconc2 (Vcharset_ordered_list, 1221 Vcharset_ordered_list = nconc2 (Vcharset_ordered_list,
1224 list1 (make_fixnum (id))); 1222 list1i (id));
1225 else 1223 else
1226 { 1224 {
1227 val = Fcons (XCAR (tail), XCDR (tail)); 1225 val = Fcons (XCAR (tail), XCDR (tail));
@@ -1278,8 +1276,7 @@ define_charset_internal (Lisp_Object name,
1278 args[charset_arg_unify_map] = Qnil; 1276 args[charset_arg_unify_map] = Qnil;
1279 1277
1280 args[charset_arg_plist] = 1278 args[charset_arg_plist] =
1281 listn (CONSTYPE_HEAP, 14, 1279 list (QCname,
1282 QCname,
1283 args[charset_arg_name], 1280 args[charset_arg_name],
1284 intern_c_string (":dimension"), 1281 intern_c_string (":dimension"),
1285 args[charset_arg_dimension], 1282 args[charset_arg_dimension],
@@ -2180,7 +2177,7 @@ usage: (set-charset-priority &rest charsets) */)
2180 } 2177 }
2181 } 2178 }
2182 Vcharset_non_preferred_head = old_list; 2179 Vcharset_non_preferred_head = old_list;
2183 Vcharset_ordered_list = CALLN (Fnconc, Fnreverse (new_head), old_list); 2180 Vcharset_ordered_list = nconc2 (Fnreverse (new_head), old_list);
2184 2181
2185 charset_ordered_list_tick++; 2182 charset_ordered_list_tick++;
2186 2183
diff --git a/src/coding.c b/src/coding.c
index e470757f92e..a216460fc2c 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -8720,20 +8720,20 @@ detect_coding_system (const unsigned char *src,
8720 { 8720 {
8721 detect_info.found = CATEGORY_MASK_RAW_TEXT; 8721 detect_info.found = CATEGORY_MASK_RAW_TEXT;
8722 id = CODING_SYSTEM_ID (Qno_conversion); 8722 id = CODING_SYSTEM_ID (Qno_conversion);
8723 val = list1 (make_fixnum (id)); 8723 val = list1i (id);
8724 } 8724 }
8725 else if (! detect_info.rejected && ! detect_info.found) 8725 else if (! detect_info.rejected && ! detect_info.found)
8726 { 8726 {
8727 detect_info.found = CATEGORY_MASK_ANY; 8727 detect_info.found = CATEGORY_MASK_ANY;
8728 id = coding_categories[coding_category_undecided].id; 8728 id = coding_categories[coding_category_undecided].id;
8729 val = list1 (make_fixnum (id)); 8729 val = list1i (id);
8730 } 8730 }
8731 else if (highest) 8731 else if (highest)
8732 { 8732 {
8733 if (detect_info.found) 8733 if (detect_info.found)
8734 { 8734 {
8735 detect_info.found = 1 << category; 8735 detect_info.found = 1 << category;
8736 val = list1 (make_fixnum (this->id)); 8736 val = list1i (this->id);
8737 } 8737 }
8738 else 8738 else
8739 for (i = 0; i < coding_category_raw_text; i++) 8739 for (i = 0; i < coding_category_raw_text; i++)
@@ -8741,7 +8741,7 @@ detect_coding_system (const unsigned char *src,
8741 { 8741 {
8742 detect_info.found = 1 << coding_priorities[i]; 8742 detect_info.found = 1 << coding_priorities[i];
8743 id = coding_categories[coding_priorities[i]].id; 8743 id = coding_categories[coding_priorities[i]].id;
8744 val = list1 (make_fixnum (id)); 8744 val = list1i (id);
8745 break; 8745 break;
8746 } 8746 }
8747 } 8747 }
@@ -8758,7 +8758,7 @@ detect_coding_system (const unsigned char *src,
8758 found |= 1 << category; 8758 found |= 1 << category;
8759 id = coding_categories[category].id; 8759 id = coding_categories[category].id;
8760 if (id >= 0) 8760 if (id >= 0)
8761 val = list1 (make_fixnum (id)); 8761 val = list1i (id);
8762 } 8762 }
8763 } 8763 }
8764 for (i = coding_category_raw_text - 1; i >= 0; i--) 8764 for (i = coding_category_raw_text - 1; i >= 0; i--)
@@ -8783,7 +8783,7 @@ detect_coding_system (const unsigned char *src,
8783 this = coding_categories + coding_category_utf_8_sig; 8783 this = coding_categories + coding_category_utf_8_sig;
8784 else 8784 else
8785 this = coding_categories + coding_category_utf_8_nosig; 8785 this = coding_categories + coding_category_utf_8_nosig;
8786 val = list1 (make_fixnum (this->id)); 8786 val = list1i (this->id);
8787 } 8787 }
8788 } 8788 }
8789 else if (base_category == coding_category_utf_16_auto) 8789 else if (base_category == coding_category_utf_16_auto)
@@ -8800,13 +8800,13 @@ detect_coding_system (const unsigned char *src,
8800 this = coding_categories + coding_category_utf_16_be_nosig; 8800 this = coding_categories + coding_category_utf_16_be_nosig;
8801 else 8801 else
8802 this = coding_categories + coding_category_utf_16_le_nosig; 8802 this = coding_categories + coding_category_utf_16_le_nosig;
8803 val = list1 (make_fixnum (this->id)); 8803 val = list1i (this->id);
8804 } 8804 }
8805 } 8805 }
8806 else 8806 else
8807 { 8807 {
8808 detect_info.found = 1 << XFIXNUM (CODING_ATTR_CATEGORY (attrs)); 8808 detect_info.found = 1 << XFIXNUM (CODING_ATTR_CATEGORY (attrs));
8809 val = list1 (make_fixnum (coding.id)); 8809 val = list1i (coding.id);
8810 } 8810 }
8811 8811
8812 /* Then, detect eol-format if necessary. */ 8812 /* Then, detect eol-format if necessary. */
@@ -9749,7 +9749,7 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9749 tset_charset_list 9749 tset_charset_list
9750 (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK 9750 (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK
9751 ? coding_charset_list (terminal_coding) 9751 ? coding_charset_list (terminal_coding)
9752 : list1 (make_fixnum (charset_ascii)))); 9752 : list1i (charset_ascii)));
9753 return Qnil; 9753 return Qnil;
9754} 9754}
9755 9755
@@ -10856,7 +10856,7 @@ syms_of_coding (void)
10856 /* Error signaled when there's a problem with detecting a coding system. */ 10856 /* Error signaled when there's a problem with detecting a coding system. */
10857 DEFSYM (Qcoding_system_error, "coding-system-error"); 10857 DEFSYM (Qcoding_system_error, "coding-system-error");
10858 Fput (Qcoding_system_error, Qerror_conditions, 10858 Fput (Qcoding_system_error, Qerror_conditions,
10859 listn (CONSTYPE_PURE, 2, Qcoding_system_error, Qerror)); 10859 pure_list (Qcoding_system_error, Qerror));
10860 Fput (Qcoding_system_error, Qerror_message, 10860 Fput (Qcoding_system_error, Qerror_message,
10861 build_pure_c_string ("Invalid coding system")); 10861 build_pure_c_string ("Invalid coding system"));
10862 10862
@@ -11298,7 +11298,7 @@ internal character representation. */);
11298 /* This is already set. 11298 /* This is already set.
11299 plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */ 11299 plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */
11300 plist[8] = intern_c_string (":charset-list"); 11300 plist[8] = intern_c_string (":charset-list");
11301 plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil); 11301 plist[9] = args[coding_arg_charset_list] = list1 (Qascii);
11302 plist[11] = args[coding_arg_for_unibyte] = Qnil; 11302 plist[11] = args[coding_arg_for_unibyte] = Qnil;
11303 plist[13] = build_pure_c_string ("No conversion on encoding, " 11303 plist[13] = build_pure_c_string ("No conversion on encoding, "
11304 "automatic conversion on decoding."); 11304 "automatic conversion on decoding.");
diff --git a/src/emacs-module.c b/src/emacs-module.c
index b70d6cea812..4e2411cb295 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1234,42 +1234,38 @@ syms_of_module (void)
1234 1234
1235 DEFSYM (Qmodule_load_failed, "module-load-failed"); 1235 DEFSYM (Qmodule_load_failed, "module-load-failed");
1236 Fput (Qmodule_load_failed, Qerror_conditions, 1236 Fput (Qmodule_load_failed, Qerror_conditions,
1237 listn (CONSTYPE_PURE, 2, Qmodule_load_failed, Qerror)); 1237 pure_list (Qmodule_load_failed, Qerror));
1238 Fput (Qmodule_load_failed, Qerror_message, 1238 Fput (Qmodule_load_failed, Qerror_message,
1239 build_pure_c_string ("Module load failed")); 1239 build_pure_c_string ("Module load failed"));
1240 1240
1241 DEFSYM (Qmodule_open_failed, "module-open-failed"); 1241 DEFSYM (Qmodule_open_failed, "module-open-failed");
1242 Fput (Qmodule_open_failed, Qerror_conditions, 1242 Fput (Qmodule_open_failed, Qerror_conditions,
1243 listn (CONSTYPE_PURE, 3, 1243 pure_list (Qmodule_open_failed, Qmodule_load_failed, Qerror));
1244 Qmodule_open_failed, Qmodule_load_failed, Qerror));
1245 Fput (Qmodule_open_failed, Qerror_message, 1244 Fput (Qmodule_open_failed, Qerror_message,
1246 build_pure_c_string ("Module could not be opened")); 1245 build_pure_c_string ("Module could not be opened"));
1247 1246
1248 DEFSYM (Qmodule_not_gpl_compatible, "module-not-gpl-compatible"); 1247 DEFSYM (Qmodule_not_gpl_compatible, "module-not-gpl-compatible");
1249 Fput (Qmodule_not_gpl_compatible, Qerror_conditions, 1248 Fput (Qmodule_not_gpl_compatible, Qerror_conditions,
1250 listn (CONSTYPE_PURE, 3, 1249 pure_list (Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror));
1251 Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror));
1252 Fput (Qmodule_not_gpl_compatible, Qerror_message, 1250 Fput (Qmodule_not_gpl_compatible, Qerror_message,
1253 build_pure_c_string ("Module is not GPL compatible")); 1251 build_pure_c_string ("Module is not GPL compatible"));
1254 1252
1255 DEFSYM (Qmissing_module_init_function, "missing-module-init-function"); 1253 DEFSYM (Qmissing_module_init_function, "missing-module-init-function");
1256 Fput (Qmissing_module_init_function, Qerror_conditions, 1254 Fput (Qmissing_module_init_function, Qerror_conditions,
1257 listn (CONSTYPE_PURE, 3, 1255 pure_list (Qmissing_module_init_function, Qmodule_load_failed,
1258 Qmissing_module_init_function, Qmodule_load_failed, Qerror)); 1256 Qerror));
1259 Fput (Qmissing_module_init_function, Qerror_message, 1257 Fput (Qmissing_module_init_function, Qerror_message,
1260 build_pure_c_string ("Module does not export an " 1258 build_pure_c_string ("Module does not export an "
1261 "initialization function")); 1259 "initialization function"));
1262 1260
1263 DEFSYM (Qmodule_init_failed, "module-init-failed"); 1261 DEFSYM (Qmodule_init_failed, "module-init-failed");
1264 Fput (Qmodule_init_failed, Qerror_conditions, 1262 Fput (Qmodule_init_failed, Qerror_conditions,
1265 listn (CONSTYPE_PURE, 3, 1263 pure_list (Qmodule_init_failed, Qmodule_load_failed, Qerror));
1266 Qmodule_init_failed, Qmodule_load_failed, Qerror));
1267 Fput (Qmodule_init_failed, Qerror_message, 1264 Fput (Qmodule_init_failed, Qerror_message,
1268 build_pure_c_string ("Module initialization failed")); 1265 build_pure_c_string ("Module initialization failed"));
1269 1266
1270 DEFSYM (Qinvalid_arity, "invalid-arity"); 1267 DEFSYM (Qinvalid_arity, "invalid-arity");
1271 Fput (Qinvalid_arity, Qerror_conditions, 1268 Fput (Qinvalid_arity, Qerror_conditions, pure_list (Qinvalid_arity, Qerror));
1272 listn (CONSTYPE_PURE, 2, Qinvalid_arity, Qerror));
1273 Fput (Qinvalid_arity, Qerror_message, 1269 Fput (Qinvalid_arity, Qerror_message,
1274 build_pure_c_string ("Invalid function arity")); 1270 build_pure_c_string ("Invalid function arity"));
1275 1271
diff --git a/src/eval.c b/src/eval.c
index e162725f03d..09e8fdf4c2a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2246,7 +2246,7 @@ eval_sub (Lisp_Object form)
2246 /* Optimize for no indirection. */ 2246 /* Optimize for no indirection. */
2247 fun = original_fun; 2247 fun = original_fun;
2248 if (!SYMBOLP (fun)) 2248 if (!SYMBOLP (fun))
2249 fun = Ffunction (Fcons (fun, Qnil)); 2249 fun = Ffunction (list1 (fun));
2250 else if (!NILP (fun) && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun))) 2250 else if (!NILP (fun) && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
2251 fun = indirect_function (fun); 2251 fun = indirect_function (fun);
2252 2252
@@ -3690,7 +3690,7 @@ backtrace_frame_apply (Lisp_Object function, union specbinding *pdl)
3690 3690
3691 Lisp_Object flags = Qnil; 3691 Lisp_Object flags = Qnil;
3692 if (backtrace_debug_on_exit (pdl)) 3692 if (backtrace_debug_on_exit (pdl))
3693 flags = Fcons (QCdebug_on_exit, Fcons (Qt, Qnil)); 3693 flags = list2 (QCdebug_on_exit, Qt);
3694 3694
3695 if (backtrace_nargs (pdl) == UNEVALLED) 3695 if (backtrace_nargs (pdl) == UNEVALLED)
3696 return call4 (function, Qnil, backtrace_function (pdl), *backtrace_args (pdl), flags); 3696 return call4 (function, Qnil, backtrace_function (pdl), *backtrace_args (pdl), flags);
diff --git a/src/fns.c b/src/fns.c
index d55158e72f1..6573124a935 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4914,13 +4914,7 @@ DEFUN ("secure-hash-algorithms", Fsecure_hash_algorithms,
4914 doc: /* Return a list of all the supported `secure_hash' algorithms. */) 4914 doc: /* Return a list of all the supported `secure_hash' algorithms. */)
4915 (void) 4915 (void)
4916{ 4916{
4917 return listn (CONSTYPE_HEAP, 6, 4917 return list (Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512);
4918 Qmd5,
4919 Qsha1,
4920 Qsha224,
4921 Qsha256,
4922 Qsha384,
4923 Qsha512);
4924} 4918}
4925 4919
4926/* Extract data from a string or a buffer. SPEC is a list of 4920/* Extract data from a string or a buffer. SPEC is a list of
diff --git a/src/font.c b/src/font.c
index 4ca44942fde..9220fb1cd24 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2781,7 +2781,7 @@ font_list_entities (struct frame *f, Lisp_Object spec)
2781 { 2781 {
2782 Lisp_Object copy; 2782 Lisp_Object copy;
2783 2783
2784 val = driver_list->driver->list (f, scratch_font_spec); 2784 val = (driver_list->driver->list) (f, scratch_font_spec);
2785 /* We put zero_vector in the font-cache to indicate that 2785 /* We put zero_vector in the font-cache to indicate that
2786 no fonts matching SPEC were found on the system. 2786 no fonts matching SPEC were found on the system.
2787 Failure to have this indication in the font cache can 2787 Failure to have this indication in the font cache can
diff --git a/src/frame.c b/src/frame.c
index d1d6993e94b..c7108d6a902 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -163,10 +163,8 @@ frame_size_history_add (struct frame *f, Lisp_Object fun_symbol,
163 Fcons (list4 163 Fcons (list4
164 (frame, fun_symbol, 164 (frame, fun_symbol,
165 ((width > 0) 165 ((width > 0)
166 ? list4 (make_fixnum (FRAME_TEXT_WIDTH (f)), 166 ? list4i (FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
167 make_fixnum (FRAME_TEXT_HEIGHT (f)), 167 width, height)
168 make_fixnum (width),
169 make_fixnum (height))
170 : Qnil), 168 : Qnil),
171 rest), 169 rest),
172 XCDR (frame_size_history))); 170 XCDR (frame_size_history)));
@@ -744,8 +742,8 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit,
744 742
745 frame_size_history_add 743 frame_size_history_add
746 (f, Qadjust_frame_size_3, new_text_width, new_text_height, 744 (f, Qadjust_frame_size_3, new_text_width, new_text_height,
747 list4 (make_fixnum (old_pixel_width), make_fixnum (old_pixel_height), 745 list4i (old_pixel_width, old_pixel_height,
748 make_fixnum (new_pixel_width), make_fixnum (new_pixel_height))); 746 new_pixel_width, new_pixel_height));
749 747
750 /* Assign new sizes. */ 748 /* Assign new sizes. */
751 FRAME_TEXT_WIDTH (f) = new_text_width; 749 FRAME_TEXT_WIDTH (f) = new_text_width;
diff --git a/src/gnutls.c b/src/gnutls.c
index 2951c8d074c..1afbb2bd4e5 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -1998,7 +1998,7 @@ The alist key is the cipher name. */)
1998 ptrdiff_t cipher_tag_size = gnutls_cipher_get_tag_size (gca); 1998 ptrdiff_t cipher_tag_size = gnutls_cipher_get_tag_size (gca);
1999 1999
2000 Lisp_Object cp 2000 Lisp_Object cp
2001 = listn (CONSTYPE_HEAP, 15, cipher_symbol, 2001 = list (cipher_symbol,
2002 QCcipher_id, make_fixnum (gca), 2002 QCcipher_id, make_fixnum (gca),
2003 QCtype, Qgnutls_type_cipher, 2003 QCtype, Qgnutls_type_cipher,
2004 QCcipher_aead_capable, cipher_tag_size == 0 ? Qnil : Qt, 2004 QCcipher_aead_capable, cipher_tag_size == 0 ? Qnil : Qt,
@@ -2329,7 +2329,7 @@ name. */)
2329# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE 2329# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
2330 nonce_size = gnutls_mac_get_nonce_size (gma); 2330 nonce_size = gnutls_mac_get_nonce_size (gma);
2331# endif 2331# endif
2332 Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol, 2332 Lisp_Object mp = list (gma_symbol,
2333 QCmac_algorithm_id, make_fixnum (gma), 2333 QCmac_algorithm_id, make_fixnum (gma),
2334 QCtype, Qgnutls_type_mac_algorithm, 2334 QCtype, Qgnutls_type_mac_algorithm,
2335 2335
@@ -2364,7 +2364,7 @@ method name. */)
2364 /* A symbol representing the GnuTLS digest algorithm. */ 2364 /* A symbol representing the GnuTLS digest algorithm. */
2365 Lisp_Object gda_symbol = intern (gnutls_digest_get_name (gda)); 2365 Lisp_Object gda_symbol = intern (gnutls_digest_get_name (gda));
2366 2366
2367 Lisp_Object mp = listn (CONSTYPE_HEAP, 7, gda_symbol, 2367 Lisp_Object mp = list (gda_symbol,
2368 QCdigest_algorithm_id, make_fixnum (gda), 2368 QCdigest_algorithm_id, make_fixnum (gda),
2369 QCtype, Qgnutls_type_digest_algorithm, 2369 QCtype, Qgnutls_type_digest_algorithm,
2370 2370
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 75fc9ea5477..58e95a46796 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -967,7 +967,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
967 { 967 {
968 frame_size_history_add 968 frame_size_history_add
969 (f, Qxg_frame_set_char_size_1, width, height, 969 (f, Qxg_frame_set_char_size_1, width, height,
970 list2 (make_fixnum (gheight), make_fixnum (totalheight))); 970 list2i (gheight, totalheight));
971 971
972 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 972 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
973 gwidth, totalheight); 973 gwidth, totalheight);
@@ -976,7 +976,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
976 { 976 {
977 frame_size_history_add 977 frame_size_history_add
978 (f, Qxg_frame_set_char_size_2, width, height, 978 (f, Qxg_frame_set_char_size_2, width, height,
979 list2 (make_fixnum (gwidth), make_fixnum (totalwidth))); 979 list2i (gwidth, totalwidth));
980 980
981 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 981 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
982 totalwidth, gheight); 982 totalwidth, gheight);
@@ -985,7 +985,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
985 { 985 {
986 frame_size_history_add 986 frame_size_history_add
987 (f, Qxg_frame_set_char_size_3, width, height, 987 (f, Qxg_frame_set_char_size_3, width, height,
988 list2 (make_fixnum (totalwidth), make_fixnum (totalheight))); 988 list2i (totalwidth, totalheight));
989 989
990 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 990 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
991 totalwidth, totalheight); 991 totalwidth, totalheight);
@@ -4260,23 +4260,16 @@ xg_get_page_setup (void)
4260 eassume (false); 4260 eassume (false);
4261 } 4261 }
4262 4262
4263 return listn (CONSTYPE_HEAP, 7, 4263#define GETSETUP(f) make_float (f (page_setup, GTK_UNIT_POINTS))
4264 Fcons (Qorientation, orientation_symbol), 4264 return
4265#define MAKE_FLOAT_PAGE_SETUP(f) make_float (f (page_setup, GTK_UNIT_POINTS)) 4265 list (Fcons (Qorientation, orientation_symbol),
4266 Fcons (Qwidth, 4266 Fcons (Qwidth, GETSETUP (gtk_page_setup_get_page_width)),
4267 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_page_width)), 4267 Fcons (Qheight, GETSETUP (gtk_page_setup_get_page_height)),
4268 Fcons (Qheight, 4268 Fcons (Qleft_margin, GETSETUP (gtk_page_setup_get_left_margin)),
4269 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_page_height)), 4269 Fcons (Qright_margin, GETSETUP (gtk_page_setup_get_right_margin)),
4270 Fcons (Qleft_margin, 4270 Fcons (Qtop_margin, GETSETUP (gtk_page_setup_get_top_margin)),
4271 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_left_margin)), 4271 Fcons (Qbottom_margin, GETSETUP (gtk_page_setup_get_bottom_margin)));
4272 Fcons (Qright_margin, 4272#undef GETSETUP
4273 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_right_margin)),
4274 Fcons (Qtop_margin,
4275 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_top_margin)),
4276 Fcons (Qbottom_margin,
4277 MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_bottom_margin))
4278#undef MAKE_FLOAT_PAGE_SETUP
4279 );
4280} 4273}
4281 4274
4282static void 4275static void
diff --git a/src/keyboard.c b/src/keyboard.c
index 38074458373..1bde3a13ba5 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1328,7 +1328,7 @@ command_loop_1 (void)
1328 if (!NILP (Vquit_flag)) 1328 if (!NILP (Vquit_flag))
1329 { 1329 {
1330 Vquit_flag = Qnil; 1330 Vquit_flag = Qnil;
1331 Vunread_command_events = list1 (make_fixnum (quit_char)); 1331 Vunread_command_events = list1i (quit_char);
1332 } 1332 }
1333 } 1333 }
1334 1334
diff --git a/src/keymap.c b/src/keymap.c
index dda552ba471..2ac3d33460c 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -120,11 +120,7 @@ The optional arg STRING supplies a menu name for the keymap
120in case you use it as a menu with `x-popup-menu'. */) 120in case you use it as a menu with `x-popup-menu'. */)
121 (Lisp_Object string) 121 (Lisp_Object string)
122{ 122{
123 Lisp_Object tail; 123 Lisp_Object tail = !NILP (string) ? list1 (string) : Qnil;
124 if (!NILP (string))
125 tail = list1 (string);
126 else
127 tail = Qnil;
128 return Fcons (Qkeymap, 124 return Fcons (Qkeymap,
129 Fcons (Fmake_char_table (Qkeymap, Qnil), tail)); 125 Fcons (Fmake_char_table (Qkeymap, Qnil), tail));
130} 126}
@@ -3608,12 +3604,12 @@ syms_of_keymap (void)
3608 Fset (intern_c_string ("ctl-x-map"), control_x_map); 3604 Fset (intern_c_string ("ctl-x-map"), control_x_map);
3609 Ffset (intern_c_string ("Control-X-prefix"), control_x_map); 3605 Ffset (intern_c_string ("Control-X-prefix"), control_x_map);
3610 3606
3611 exclude_keys = listn (CONSTYPE_PURE, 5, 3607 exclude_keys = pure_list
3612 pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), 3608 (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")),
3613 pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), 3609 pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")),
3614 pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), 3610 pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")),
3615 pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), 3611 pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")),
3616 pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" "))); 3612 pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")));
3617 staticpro (&exclude_keys); 3613 staticpro (&exclude_keys);
3618 3614
3619 DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands, 3615 DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands,
@@ -3669,16 +3665,12 @@ be preferred. */);
3669 DEFSYM (Qmode_line, "mode-line"); 3665 DEFSYM (Qmode_line, "mode-line");
3670 3666
3671 staticpro (&Vmouse_events); 3667 staticpro (&Vmouse_events);
3672 Vmouse_events = listn (CONSTYPE_PURE, 9, 3668 Vmouse_events = pure_list (Qmenu_bar, Qtool_bar, Qheader_line, Qmode_line,
3673 Qmenu_bar, 3669 intern_c_string ("mouse-1"),
3674 Qtool_bar, 3670 intern_c_string ("mouse-2"),
3675 Qheader_line, 3671 intern_c_string ("mouse-3"),
3676 Qmode_line, 3672 intern_c_string ("mouse-4"),
3677 intern_c_string ("mouse-1"), 3673 intern_c_string ("mouse-5"));
3678 intern_c_string ("mouse-2"),
3679 intern_c_string ("mouse-3"),
3680 intern_c_string ("mouse-4"),
3681 intern_c_string ("mouse-5"));
3682 3674
3683 /* Keymap used for minibuffers when doing completion. */ 3675 /* Keymap used for minibuffers when doing completion. */
3684 /* Keymap used for minibuffers when doing completion and require a match. */ 3676 /* Keymap used for minibuffers when doing completion and require a match. */
diff --git a/src/kqueue.c b/src/kqueue.c
index 43e75cac310..48121bd663a 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -99,7 +99,7 @@ kqueue_generate_event (Lisp_Object watch_object, Lisp_Object actions,
99 event.arg = list2 (Fcons (XCAR (watch_object), 99 event.arg = list2 (Fcons (XCAR (watch_object),
100 Fcons (actions, 100 Fcons (actions,
101 NILP (file1) 101 NILP (file1)
102 ? Fcons (file, Qnil) 102 ? list1 (file)
103 : list2 (file, file1))), 103 : list2 (file, file1))),
104 Fnth (make_fixnum (3), watch_object)); 104 Fnth (make_fixnum (3), watch_object));
105 kbd_buffer_store_event (&event); 105 kbd_buffer_store_event (&event);
diff --git a/src/lisp.h b/src/lisp.h
index 2a3eaf38122..4391e173741 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3782,8 +3782,12 @@ extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
3782extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); 3782extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
3783extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, 3783extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
3784 Lisp_Object); 3784 Lisp_Object);
3785enum constype {CONSTYPE_HEAP, CONSTYPE_PURE}; 3785extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...);
3786extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...); 3786extern Lisp_Object pure_listn (ptrdiff_t, Lisp_Object, ...);
3787#define list(...) \
3788 listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
3789#define pure_list(...) \
3790 pure_listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
3787 3791
3788enum gc_root_type { 3792enum gc_root_type {
3789 GC_ROOT_STATICPRO, 3793 GC_ROOT_STATICPRO,
@@ -3800,7 +3804,13 @@ struct gc_root_visitor {
3800}; 3804};
3801extern void visit_static_gc_roots (struct gc_root_visitor visitor); 3805extern void visit_static_gc_roots (struct gc_root_visitor visitor);
3802 3806
3803/* Build a frequently used 2/3/4-integer lists. */ 3807/* Build a frequently used 1/2/3/4-integer lists. */
3808
3809INLINE Lisp_Object
3810list1i (EMACS_INT x)
3811{
3812 return list1 (make_fixnum (x));
3813}
3804 3814
3805INLINE Lisp_Object 3815INLINE Lisp_Object
3806list2i (EMACS_INT x, EMACS_INT y) 3816list2i (EMACS_INT x, EMACS_INT y)
diff --git a/src/nsfns.m b/src/nsfns.m
index 60d62310bb0..ee7598a1c7e 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2811,23 +2811,20 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
2811 2811
2812 /* Construct list. */ 2812 /* Construct list. */
2813 if (EQ (attribute, Qouter_edges)) 2813 if (EQ (attribute, Qouter_edges))
2814 return list4 (make_fixnum (f->left_pos), make_fixnum (f->top_pos), 2814 return list4i (f->left_pos, f->top_pos,
2815 make_fixnum (f->left_pos + outer_width), 2815 f->left_pos + outer_width,
2816 make_fixnum (f->top_pos + outer_height)); 2816 f->top_pos + outer_height);
2817 else if (EQ (attribute, Qnative_edges)) 2817 else if (EQ (attribute, Qnative_edges))
2818 return list4 (make_fixnum (native_left), make_fixnum (native_top), 2818 return list4i (native_left, native_top,
2819 make_fixnum (native_right), make_fixnum (native_bottom)); 2819 native_right, native_bottom);
2820 else if (EQ (attribute, Qinner_edges)) 2820 else if (EQ (attribute, Qinner_edges))
2821 return list4 (make_fixnum (native_left + internal_border_width), 2821 return list4i (native_left + internal_border_width,
2822 make_fixnum (native_top 2822 native_top + tool_bar_height + internal_border_width,
2823 + tool_bar_height 2823 native_right - internal_border_width,
2824 + internal_border_width), 2824 native_bottom - internal_border_width);
2825 make_fixnum (native_right - internal_border_width),
2826 make_fixnum (native_bottom - internal_border_width));
2827 else 2825 else
2828 return 2826 return
2829 listn (CONSTYPE_HEAP, 10, 2827 list (Fcons (Qouter_position,
2830 Fcons (Qouter_position,
2831 Fcons (make_fixnum (f->left_pos), 2828 Fcons (make_fixnum (f->left_pos),
2832 make_fixnum (f->top_pos))), 2829 make_fixnum (f->top_pos))),
2833 Fcons (Qouter_size, 2830 Fcons (Qouter_size,
diff --git a/src/nsterm.m b/src/nsterm.m
index d0fe206d2e3..ccf8ecc4d26 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -500,7 +500,7 @@ append2 (Lisp_Object list, Lisp_Object item)
500 Utility to append to a list 500 Utility to append to a list
501 -------------------------------------------------------------------------- */ 501 -------------------------------------------------------------------------- */
502{ 502{
503 return CALLN (Fnconc, list, list1 (item)); 503 return nconc2 (list, list (item));
504} 504}
505 505
506 506
@@ -8284,7 +8284,7 @@ not_in_argv (NSString *arg)
8284 8284
8285 type_sym = Qurl; 8285 type_sym = Qurl;
8286 8286
8287 strings = Fcons (build_string ([[url absoluteString] UTF8String]), Qnil); 8287 strings = list1 (build_string ([[url absoluteString] UTF8String]));
8288 } 8288 }
8289 else if ([type isEqualToString: NSStringPboardType] 8289 else if ([type isEqualToString: NSStringPboardType]
8290 || [type isEqualToString: NSTabularTextPboardType]) 8290 || [type isEqualToString: NSTabularTextPboardType])
@@ -8296,7 +8296,7 @@ not_in_argv (NSString *arg)
8296 8296
8297 type_sym = Qnil; 8297 type_sym = Qnil;
8298 8298
8299 strings = Fcons (build_string ([data UTF8String]), Qnil); 8299 strings = list1 (build_string ([data UTF8String]));
8300 } 8300 }
8301 else 8301 else
8302 { 8302 {
diff --git a/src/pdumper.c b/src/pdumper.c
index bba43370a14..dd272a0389d 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5580,8 +5580,7 @@ Value is nil if this session was not started using a portable dump file.*/)
5580 5580
5581 dump_fn = Fexpand_file_name (dump_fn, Qnil); 5581 dump_fn = Fexpand_file_name (dump_fn, Qnil);
5582 5582
5583 return CALLN (Flist, 5583 return list3 (Fcons (Qdumped_with_pdumper, Qt),
5584 Fcons (Qdumped_with_pdumper, Qt),
5585 Fcons (Qload_time, make_float (dump_private.load_time)), 5584 Fcons (Qload_time, make_float (dump_private.load_time)),
5586 Fcons (Qdump_file_name, dump_fn)); 5585 Fcons (Qdump_file_name, dump_fn));
5587} 5586}
diff --git a/src/search.c b/src/search.c
index 17bc8d0c948..a1e0b0976ed 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3402,18 +3402,17 @@ syms_of_search (void)
3402 DEFSYM (Qinvalid_regexp, "invalid-regexp"); 3402 DEFSYM (Qinvalid_regexp, "invalid-regexp");
3403 3403
3404 Fput (Qsearch_failed, Qerror_conditions, 3404 Fput (Qsearch_failed, Qerror_conditions,
3405 listn (CONSTYPE_PURE, 2, Qsearch_failed, Qerror)); 3405 pure_list (Qsearch_failed, Qerror));
3406 Fput (Qsearch_failed, Qerror_message, 3406 Fput (Qsearch_failed, Qerror_message,
3407 build_pure_c_string ("Search failed")); 3407 build_pure_c_string ("Search failed"));
3408 3408
3409 Fput (Quser_search_failed, Qerror_conditions, 3409 Fput (Quser_search_failed, Qerror_conditions,
3410 listn (CONSTYPE_PURE, 4, 3410 pure_list (Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
3411 Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
3412 Fput (Quser_search_failed, Qerror_message, 3411 Fput (Quser_search_failed, Qerror_message,
3413 build_pure_c_string ("Search failed")); 3412 build_pure_c_string ("Search failed"));
3414 3413
3415 Fput (Qinvalid_regexp, Qerror_conditions, 3414 Fput (Qinvalid_regexp, Qerror_conditions,
3416 listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror)); 3415 pure_list (Qinvalid_regexp, Qerror));
3417 Fput (Qinvalid_regexp, Qerror_message, 3416 Fput (Qinvalid_regexp, Qerror_message,
3418 build_pure_c_string ("Invalid regexp")); 3417 build_pure_c_string ("Invalid regexp"));
3419 3418
diff --git a/src/syntax.c b/src/syntax.c
index 32103c8657c..5c38e92026e 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3719,7 +3719,7 @@ syms_of_syntax (void)
3719 3719
3720 DEFSYM (Qscan_error, "scan-error"); 3720 DEFSYM (Qscan_error, "scan-error");
3721 Fput (Qscan_error, Qerror_conditions, 3721 Fput (Qscan_error, Qerror_conditions,
3722 listn (CONSTYPE_PURE, 2, Qscan_error, Qerror)); 3722 pure_list (Qscan_error, Qerror));
3723 Fput (Qscan_error, Qerror_message, 3723 Fput (Qscan_error, Qerror_message,
3724 build_pure_c_string ("Scan error")); 3724 build_pure_c_string ("Scan error"));
3725 3725
diff --git a/src/w32.c b/src/w32.c
index 197f6ddee2f..f3e88afd5bf 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2982,8 +2982,7 @@ init_environment (char ** argv)
2982 if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata) 2982 if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
2983 Vdelayed_warnings_list 2983 Vdelayed_warnings_list
2984 = Fcons 2984 = Fcons
2985 (listn (CONSTYPE_HEAP, 2, 2985 (list2 (intern ("initialization"), build_string
2986 intern ("initialization"), build_string
2987 ("Use of `C:\\.emacs' without defining `HOME'\n" 2986 ("Use of `C:\\.emacs' without defining `HOME'\n"
2988 "in the environment is deprecated, " 2987 "in the environment is deprecated, "
2989 "see `Windows HOME' in the Emacs manual.")), 2988 "see `Windows HOME' in the Emacs manual.")),
diff --git a/src/w32cygwinx.c b/src/w32cygwinx.c
index 086dcd15b43..3b994b16b3f 100644
--- a/src/w32cygwinx.c
+++ b/src/w32cygwinx.c
@@ -115,8 +115,7 @@ The following %-sequences are provided:
115 remain = format_string ("%ld:%02ld", m / 60, m % 60); 115 remain = format_string ("%ld:%02ld", m / 60, m % 60);
116 } 116 }
117 117
118 status = listn (CONSTYPE_HEAP, 8, 118 status = list (Fcons (make_fixnum ('L'), line_status),
119 Fcons (make_fixnum ('L'), line_status),
120 Fcons (make_fixnum ('B'), battery_status), 119 Fcons (make_fixnum ('B'), battery_status),
121 Fcons (make_fixnum ('b'), battery_status_symbol), 120 Fcons (make_fixnum ('b'), battery_status_symbol),
122 Fcons (make_fixnum ('p'), load_percentage), 121 Fcons (make_fixnum ('p'), load_percentage),
diff --git a/src/w32fns.c b/src/w32fns.c
index 29d85c4826c..4a32d496350 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8787,8 +8787,7 @@ and width values are in pixels.
8787 /* A single line menu bar. */ 8787 /* A single line menu bar. */
8788 menu_bar_height = single_menu_bar_height; 8788 menu_bar_height = single_menu_bar_height;
8789 8789
8790 return listn (CONSTYPE_HEAP, 10, 8790 return list (Fcons (Qouter_position,
8791 Fcons (Qouter_position,
8792 Fcons (make_fixnum (left), make_fixnum (top))), 8791 Fcons (make_fixnum (left), make_fixnum (top))),
8793 Fcons (Qouter_size, 8792 Fcons (Qouter_size,
8794 Fcons (make_fixnum (right - left), 8793 Fcons (make_fixnum (right - left),
@@ -10257,7 +10256,7 @@ syms_of_w32fns (void)
10257 DEFSYM (Qjson, "json"); 10256 DEFSYM (Qjson, "json");
10258 10257
10259 Fput (Qundefined_color, Qerror_conditions, 10258 Fput (Qundefined_color, Qerror_conditions,
10260 listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); 10259 pure_list (Qundefined_color, Qerror));
10261 Fput (Qundefined_color, Qerror_message, 10260 Fput (Qundefined_color, Qerror_message,
10262 build_pure_c_string ("Undefined color")); 10261 build_pure_c_string ("Undefined color"));
10263 10262
diff --git a/src/widget.c b/src/widget.c
index 9db33168a2a..c695bd5f305 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -282,7 +282,7 @@ set_frame_size (EmacsFrame ew)
282 282
283 frame_size_history_add 283 frame_size_history_add
284 (f, Qset_frame_size, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 284 (f, Qset_frame_size, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
285 list2 (make_fixnum (ew->core.width), make_fixnum (ew->core.height))); 285 list2i (ew->core.width, ew->core.height));
286} 286}
287 287
288static void 288static void
diff --git a/src/window.c b/src/window.c
index fe685d5ab09..642c77ba56e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2525,7 +2525,7 @@ window_list (void)
2525 have to reverse this list at the end. */ 2525 have to reverse this list at the end. */
2526 foreach_window (XFRAME (frame), add_window_to_list, &arglist); 2526 foreach_window (XFRAME (frame), add_window_to_list, &arglist);
2527 arglist = Fnreverse (arglist); 2527 arglist = Fnreverse (arglist);
2528 Vwindow_list = CALLN (Fnconc, Vwindow_list, arglist); 2528 Vwindow_list = nconc2 (Vwindow_list, arglist);
2529 } 2529 }
2530 } 2530 }
2531 2531
diff --git a/src/xdisp.c b/src/xdisp.c
index 760c31c6768..d728e0f111c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -32932,14 +32932,12 @@ and is used only on frames for which no explicit name has been set
32932\(see `modify-frame-parameters'). */); 32932\(see `modify-frame-parameters'). */);
32933 Vicon_title_format 32933 Vicon_title_format
32934 = Vframe_title_format 32934 = Vframe_title_format
32935 = listn (CONSTYPE_PURE, 3, 32935 = pure_list (intern_c_string ("multiple-frames"),
32936 intern_c_string ("multiple-frames"), 32936 build_pure_c_string ("%b"),
32937 build_pure_c_string ("%b"), 32937 pure_list (empty_unibyte_string,
32938 listn (CONSTYPE_PURE, 4, 32938 intern_c_string ("invocation-name"),
32939 empty_unibyte_string, 32939 build_pure_c_string ("@"),
32940 intern_c_string ("invocation-name"), 32940 intern_c_string ("system-name")));
32941 build_pure_c_string ("@"),
32942 intern_c_string ("system-name")));
32943 32941
32944 DEFVAR_LISP ("message-log-max", Vmessage_log_max, 32942 DEFVAR_LISP ("message-log-max", Vmessage_log_max,
32945 doc: /* Maximum number of lines to keep in the message log buffer. 32943 doc: /* Maximum number of lines to keep in the message log buffer.
diff --git a/src/xfaces.c b/src/xfaces.c
index e397f0b8a03..c6723ebe2c3 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1597,7 +1597,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1597 /* We don't have to check fontsets. */ 1597 /* We don't have to check fontsets. */
1598 return fonts; 1598 return fonts;
1599 Lisp_Object fontsets = list_fontsets (f, pattern, size); 1599 Lisp_Object fontsets = list_fontsets (f, pattern, size);
1600 return CALLN (Fnconc, fonts, fontsets); 1600 return nconc2 (fonts, fontsets);
1601} 1601}
1602 1602
1603#endif /* HAVE_WINDOW_SYSTEM */ 1603#endif /* HAVE_WINDOW_SYSTEM */
@@ -4254,12 +4254,8 @@ two lists of the form (RED GREEN BLUE) aforementioned. */)
4254 return make_fixnum (color_distance (&cdef1, &cdef2)); 4254 return make_fixnum (color_distance (&cdef1, &cdef2));
4255 else 4255 else
4256 return call2 (metric, 4256 return call2 (metric,
4257 list3 (make_fixnum (cdef1.red), 4257 list3i (cdef1.red, cdef1.green, cdef1.blue),
4258 make_fixnum (cdef1.green), 4258 list3i (cdef2.red, cdef2.green, cdef2.blue));
4259 make_fixnum (cdef1.blue)),
4260 list3 (make_fixnum (cdef2.red),
4261 make_fixnum (cdef2.green),
4262 make_fixnum (cdef2.blue)));
4263} 4259}
4264 4260
4265 4261
diff --git a/src/xfns.c b/src/xfns.c
index 9cea420a404..a627b7e19e6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5185,18 +5185,14 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
5185 5185
5186 /* Construct list. */ 5186 /* Construct list. */
5187 if (EQ (attribute, Qouter_edges)) 5187 if (EQ (attribute, Qouter_edges))
5188 return list4 (make_fixnum (outer_left), make_fixnum (outer_top), 5188 return list4i (outer_left, outer_top, outer_right, outer_bottom);
5189 make_fixnum (outer_right), make_fixnum (outer_bottom));
5190 else if (EQ (attribute, Qnative_edges)) 5189 else if (EQ (attribute, Qnative_edges))
5191 return list4 (make_fixnum (native_left), make_fixnum (native_top), 5190 return list4i (native_left, native_top, native_right, native_bottom);
5192 make_fixnum (native_right), make_fixnum (native_bottom));
5193 else if (EQ (attribute, Qinner_edges)) 5191 else if (EQ (attribute, Qinner_edges))
5194 return list4 (make_fixnum (inner_left), make_fixnum (inner_top), 5192 return list4i (inner_left, inner_top, inner_right, inner_bottom);
5195 make_fixnum (inner_right), make_fixnum (inner_bottom));
5196 else 5193 else
5197 return 5194 return
5198 listn (CONSTYPE_HEAP, 11, 5195 list (Fcons (Qouter_position,
5199 Fcons (Qouter_position,
5200 Fcons (make_fixnum (outer_left), 5196 Fcons (make_fixnum (outer_left),
5201 make_fixnum (outer_top))), 5197 make_fixnum (outer_top))),
5202 Fcons (Qouter_size, 5198 Fcons (Qouter_size,
@@ -7675,7 +7671,7 @@ syms_of_xfns (void)
7675#endif 7671#endif
7676 7672
7677 Fput (Qundefined_color, Qerror_conditions, 7673 Fput (Qundefined_color, Qerror_conditions,
7678 listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); 7674 pure_list (Qundefined_color, Qerror));
7679 Fput (Qundefined_color, Qerror_message, 7675 Fput (Qundefined_color, Qerror_message,
7680 build_pure_c_string ("Undefined color")); 7676 build_pure_c_string ("Undefined color"));
7681 7677
diff --git a/src/xterm.c b/src/xterm.c
index 453669f6e02..73a38de3719 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11181,8 +11181,7 @@ x_set_window_size_1 (struct frame *f, bool change_gravity,
11181 { 11181 {
11182 frame_size_history_add 11182 frame_size_history_add
11183 (f, Qx_set_window_size_1, width, height, 11183 (f, Qx_set_window_size_1, width, height,
11184 list2 (make_fixnum (old_height), 11184 list2i (old_height, pixelheight + FRAME_MENUBAR_HEIGHT (f)));
11185 make_fixnum (pixelheight + FRAME_MENUBAR_HEIGHT (f))));
11186 11185
11187 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 11186 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
11188 old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f)); 11187 old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f));
@@ -11191,7 +11190,7 @@ x_set_window_size_1 (struct frame *f, bool change_gravity,
11191 { 11190 {
11192 frame_size_history_add 11191 frame_size_history_add
11193 (f, Qx_set_window_size_2, width, height, 11192 (f, Qx_set_window_size_2, width, height,
11194 list2 (make_fixnum (old_width), make_fixnum (pixelwidth))); 11193 list2i (old_width, pixelwidth));
11195 11194
11196 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 11195 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
11197 pixelwidth, old_height); 11196 pixelwidth, old_height);
@@ -11201,10 +11200,10 @@ x_set_window_size_1 (struct frame *f, bool change_gravity,
11201 { 11200 {
11202 frame_size_history_add 11201 frame_size_history_add
11203 (f, Qx_set_window_size_3, width, height, 11202 (f, Qx_set_window_size_3, width, height,
11204 list3 (make_fixnum (pixelwidth + FRAME_TOOLBAR_WIDTH (f)), 11203 list3i (pixelwidth + FRAME_TOOLBAR_WIDTH (f),
11205 make_fixnum (pixelheight + FRAME_TOOLBAR_HEIGHT (f) 11204 (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
11206 + FRAME_MENUBAR_HEIGHT (f)), 11205 + FRAME_MENUBAR_HEIGHT (f)),
11207 make_fixnum (FRAME_MENUBAR_HEIGHT (f)))); 11206 FRAME_MENUBAR_HEIGHT (f)));
11208 11207
11209 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 11208 XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
11210 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f)); 11209 pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f));
diff --git a/src/xwidget.c b/src/xwidget.c
index dcbccdf27c7..c56284928e3 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -831,8 +831,7 @@ Emacs allocated area accordingly. */)
831 CHECK_XWIDGET (xwidget); 831 CHECK_XWIDGET (xwidget);
832 GtkRequisition requisition; 832 GtkRequisition requisition;
833 gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition); 833 gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition);
834 return list2 (make_fixnum (requisition.width), 834 return list2i (requisition.width, requisition.height);
835 make_fixnum (requisition.height));
836} 835}
837 836
838DEFUN ("xwidgetp", 837DEFUN ("xwidgetp",