diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-03-04 00:00:39 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-03-04 00:05:04 -0800 |
commit | 5c2563a5472cd5580e7af570aa320ac581ad1985 (patch) | |
tree | fbf88ede49dc0ba527d3925dfc274c230b8cf95f /src/nsfns.m | |
parent | d6b3e5bbc5e14c32f3faad9f1481ec16807ac2fe (diff) | |
download | emacs-5c2563a5472cd5580e7af570aa320ac581ad1985.tar.gz |
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/nsfns.m')
-rw-r--r-- | src/nsfns.m | 23 |
1 files changed, 10 insertions, 13 deletions
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) /* Construct list. */ if (EQ (attribute, Qouter_edges)) - return list4 (make_fixnum (f->left_pos), make_fixnum (f->top_pos), - make_fixnum (f->left_pos + outer_width), - make_fixnum (f->top_pos + outer_height)); + return list4i (f->left_pos, f->top_pos, + f->left_pos + outer_width, + f->top_pos + outer_height); else if (EQ (attribute, Qnative_edges)) - return list4 (make_fixnum (native_left), make_fixnum (native_top), - make_fixnum (native_right), make_fixnum (native_bottom)); + return list4i (native_left, native_top, + native_right, native_bottom); else if (EQ (attribute, Qinner_edges)) - return list4 (make_fixnum (native_left + internal_border_width), - make_fixnum (native_top - + tool_bar_height - + internal_border_width), - make_fixnum (native_right - internal_border_width), - make_fixnum (native_bottom - internal_border_width)); + return list4i (native_left + internal_border_width, + native_top + tool_bar_height + internal_border_width, + native_right - internal_border_width, + native_bottom - internal_border_width); else return - listn (CONSTYPE_HEAP, 10, - Fcons (Qouter_position, + list (Fcons (Qouter_position, Fcons (make_fixnum (f->left_pos), make_fixnum (f->top_pos))), Fcons (Qouter_size, |