aboutsummaryrefslogtreecommitdiffstats
path: root/src/macfont.m
diff options
context:
space:
mode:
authorPaul Eggert2019-01-09 09:52:38 -0800
committerPaul Eggert2019-01-09 09:59:10 -0800
commita84650334e30b2451bf4a8957bf2d57ade296d4e (patch)
treeb5642bb98eb89733def116fb6d864f74855023e2 /src/macfont.m
parentf9d0fd6c1953138f7473a22917a1508740b2ce40 (diff)
downloademacs-a84650334e30b2451bf4a8957bf2d57ade296d4e.tar.gz
emacs-a84650334e30b2451bf4a8957bf2d57ade296d4e.zip
Use shortcuts for Flength
When calculating the length of a Lisp object whose type is known, use a specialized length operation on it to save a bit of runtime overhead. * src/callint.c (Fcall_interactively): * src/minibuf.c (read_minibuf_unwind): Use ASIZE rather than Flength on values that must be vectors. * src/charset.c (Fsort_charsets): * src/coding.c (detect_coding_sjis): (Fdefine_coding_system_internal): * src/data.c (wrong_choice): * src/eval.c (Flet, eval_sub, Fapply, apply_lambda): * src/fns.c (sort_list): * src/font.c (font_vconcat_entity_vectors) (font_find_for_lface): * src/frame.c (Fmodify_frame_parameters): * src/fringe.c (get_logical_fringe_bitmap): * src/ftfont.c (ftfont_get_open_type_spec): * src/gtkutil.c (xg_print_frames_dialog): * src/lread.c (read1, read_vector): * src/keymap.c (Fkey_description): * src/kqueue.c (Fkqueue_add_watch): * src/macfont.m (macfont_get_open_type_spec): * src/menu.c (parse_single_submenu, x_popup_menu_1): * src/minibuf.c (Finternal_complete_buffer): * src/nsfont.m (ns_findfonts, nsfont_list_family): * src/process.c (Fmake_process): * src/search.c (Fset_match_data): * src/xfaces.c (Fx_family_fonts): Use list_length rather than Flength on values that must be lists. * src/fns.c (list_length): New function. (Flength): Use it. * src/nsfont.m (ns_findfonts): Use !NILP (x) rather than XFIXNUM (Flength (x)) != 0. * src/xdisp.c (store_mode_line_string): Use SCHARS rather than Flength on values that must be strings.
Diffstat (limited to 'src/macfont.m')
-rw-r--r--src/macfont.m8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/macfont.m b/src/macfont.m
index 0e90eb44eeb..09c4ff31c88 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1791,16 +1791,14 @@ macfont_get_open_type_spec (Lisp_Object otf_spec)
1791 spec->nfeatures[0] = spec->nfeatures[1] = 0; 1791 spec->nfeatures[0] = spec->nfeatures[1] = 0;
1792 for (i = 0; i < 2 && ! NILP (otf_spec); i++, otf_spec = XCDR (otf_spec)) 1792 for (i = 0; i < 2 && ! NILP (otf_spec); i++, otf_spec = XCDR (otf_spec))
1793 { 1793 {
1794 Lisp_Object len;
1795
1796 val = XCAR (otf_spec); 1794 val = XCAR (otf_spec);
1797 if (NILP (val)) 1795 if (NILP (val))
1798 continue; 1796 continue;
1799 len = Flength (val); 1797 ptrdiff_t len = list_length (val);
1800 spec->features[i] = 1798 spec->features[i] =
1801 (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XFIXNUM (len) 1799 (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < len
1802 ? 0 1800 ? 0
1803 : malloc (XFIXNUM (len) * sizeof *spec->features[i])); 1801 : malloc (len * sizeof *spec->features[i]));
1804 if (! spec->features[i]) 1802 if (! spec->features[i])
1805 { 1803 {
1806 if (i > 0 && spec->features[0]) 1804 if (i > 0 && spec->features[0])