diff options
| author | Paul Eggert | 2019-01-09 09:52:38 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-01-09 09:59:10 -0800 |
| commit | a84650334e30b2451bf4a8957bf2d57ade296d4e (patch) | |
| tree | b5642bb98eb89733def116fb6d864f74855023e2 /src/coding.c | |
| parent | f9d0fd6c1953138f7473a22917a1508740b2ce40 (diff) | |
| download | emacs-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/coding.c')
| -rw-r--r-- | src/coding.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/coding.c b/src/coding.c index 0297c8a100d..1c1462198ca 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -4591,8 +4591,7 @@ detect_coding_sjis (struct coding_system *coding, | |||
| 4591 | int max_first_byte_of_2_byte_code; | 4591 | int max_first_byte_of_2_byte_code; |
| 4592 | 4592 | ||
| 4593 | CODING_GET_INFO (coding, attrs, charset_list); | 4593 | CODING_GET_INFO (coding, attrs, charset_list); |
| 4594 | max_first_byte_of_2_byte_code | 4594 | max_first_byte_of_2_byte_code = list_length (charset_list) <= 3 ? 0xEF : 0xFC; |
| 4595 | = (XFIXNUM (Flength (charset_list)) > 3 ? 0xFC : 0xEF); | ||
| 4596 | 4595 | ||
| 4597 | detect_info->checked |= CATEGORY_MASK_SJIS; | 4596 | detect_info->checked |= CATEGORY_MASK_SJIS; |
| 4598 | /* A coding system of this category is always ASCII compatible. */ | 4597 | /* A coding system of this category is always ASCII compatible. */ |
| @@ -10387,14 +10386,11 @@ usage: (define-coding-system-internal ...) */) | |||
| 10387 | } | 10386 | } |
| 10388 | else if (EQ (coding_type, Qshift_jis)) | 10387 | else if (EQ (coding_type, Qshift_jis)) |
| 10389 | { | 10388 | { |
| 10390 | 10389 | ptrdiff_t charset_list_len = list_length (charset_list); | |
| 10391 | struct charset *charset; | 10390 | if (charset_list_len != 3 && charset_list_len != 4) |
| 10392 | |||
| 10393 | if (XFIXNUM (Flength (charset_list)) != 3 | ||
| 10394 | && XFIXNUM (Flength (charset_list)) != 4) | ||
| 10395 | error ("There should be three or four charsets"); | 10391 | error ("There should be three or four charsets"); |
| 10396 | 10392 | ||
| 10397 | charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list))); | 10393 | struct charset *charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list))); |
| 10398 | if (CHARSET_DIMENSION (charset) != 1) | 10394 | if (CHARSET_DIMENSION (charset) != 1) |
| 10399 | error ("Dimension of charset %s is not one", | 10395 | error ("Dimension of charset %s is not one", |
| 10400 | SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); | 10396 | SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); |
| @@ -10429,7 +10425,7 @@ usage: (define-coding-system-internal ...) */) | |||
| 10429 | { | 10425 | { |
| 10430 | struct charset *charset; | 10426 | struct charset *charset; |
| 10431 | 10427 | ||
| 10432 | if (XFIXNUM (Flength (charset_list)) != 2) | 10428 | if (list_length (charset_list) != 2) |
| 10433 | error ("There should be just two charsets"); | 10429 | error ("There should be just two charsets"); |
| 10434 | 10430 | ||
| 10435 | charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list))); | 10431 | charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list))); |