mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-04 11:00:45 -08:00
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.
This commit is contained in:
parent
f9d0fd6c19
commit
a84650334e
23 changed files with 98 additions and 124 deletions
14
src/coding.c
14
src/coding.c
|
|
@ -4591,8 +4591,7 @@ detect_coding_sjis (struct coding_system *coding,
|
|||
int max_first_byte_of_2_byte_code;
|
||||
|
||||
CODING_GET_INFO (coding, attrs, charset_list);
|
||||
max_first_byte_of_2_byte_code
|
||||
= (XFIXNUM (Flength (charset_list)) > 3 ? 0xFC : 0xEF);
|
||||
max_first_byte_of_2_byte_code = list_length (charset_list) <= 3 ? 0xEF : 0xFC;
|
||||
|
||||
detect_info->checked |= CATEGORY_MASK_SJIS;
|
||||
/* A coding system of this category is always ASCII compatible. */
|
||||
|
|
@ -10387,14 +10386,11 @@ usage: (define-coding-system-internal ...) */)
|
|||
}
|
||||
else if (EQ (coding_type, Qshift_jis))
|
||||
{
|
||||
|
||||
struct charset *charset;
|
||||
|
||||
if (XFIXNUM (Flength (charset_list)) != 3
|
||||
&& XFIXNUM (Flength (charset_list)) != 4)
|
||||
ptrdiff_t charset_list_len = list_length (charset_list);
|
||||
if (charset_list_len != 3 && charset_list_len != 4)
|
||||
error ("There should be three or four charsets");
|
||||
|
||||
charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
|
||||
struct charset *charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
|
||||
if (CHARSET_DIMENSION (charset) != 1)
|
||||
error ("Dimension of charset %s is not one",
|
||||
SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
|
||||
|
|
@ -10429,7 +10425,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
{
|
||||
struct charset *charset;
|
||||
|
||||
if (XFIXNUM (Flength (charset_list)) != 2)
|
||||
if (list_length (charset_list) != 2)
|
||||
error ("There should be just two charsets");
|
||||
|
||||
charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue