diff options
| author | Paul Eggert | 2018-12-09 00:18:36 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-12-09 00:23:55 -0800 |
| commit | d79bb75683ceb4eee2f753eb38fa8db99aff4568 (patch) | |
| tree | b0b20c25387c2eb11b2c79e87898bec2c39b14ea /src/charset.c | |
| parent | c2fdd50c3cb0b03d2414370c58c1aa2a6ec3311d (diff) | |
| download | emacs-d79bb75683ceb4eee2f753eb38fa8db99aff4568.tar.gz emacs-d79bb75683ceb4eee2f753eb38fa8db99aff4568.zip | |
Add make_vector and make_nil_vector
This makes the callers a bit easier to read, and doubtless
improves efficiency very slightly. It also simplifies
possible future changes to allow bignum indexes to buffers.
* src/alloc.c (allocate_vectorlike):
Prefer ptrdiff_t to size_t when either will do.
(make_vector): New function.
(Fmake_vector): Use it.
* src/buffer.c (syms_of_buffer):
* src/bytecode.c (syms_of_bytecode):
* src/category.c (Fmake_category_table, init_category_once):
* src/ccl.c (syms_of_ccl):
* src/character.c (syms_of_character):
* src/charset.c (Fdefine_charset_internal)
(Ffind_charset_region, Ffind_charset_string):
* src/chartab.c (copy_char_table):
* src/coding.c (Fdefine_coding_system_internal, syms_of_coding):
* src/composite.c (get_composition_id, Fcomposition_get_gstring):
* src/composite.h (LGLYPH_NEW):
* src/fns.c (concat, Flocale_info, make_hash_table):
* src/font.c (font_otf_ValueRecord, font_otf_anchor)
(build_style_table, syms_of_font):
* src/fontset.c (RFONT_DEF_NEW, fontset_find_font)
(dump_fontset, syms_of_fontset):
* src/image.c (xpm_make_color_table_v):
* src/keyboard.c (modify_event_symbol, menu_bar_items)
(parse_menu_item, parse_tool_bar_item, init_tool_bar_items)
(syms_of_keyboard):
* src/keymap.c (Fdefine_key, describe_map, describe_vector):
* src/lread.c (read_vector):
* src/macfont.m (macfont_shape):
* src/menu.c (init_menu_items):
* src/nsfns.m (ns_make_monitor_attribute_list):
* src/process.c (conv_sockaddr_to_lisp, network_interface_info):
* src/profiler.c (make_log):
* src/window.c (Fcurrent_window_configuration):
* src/xdisp.c (with_echo_area_buffer_unwind_data)
(format_mode_line_unwind_data):
* src/xfaces.c (Finternal_make_lisp_face)
(Fface_attributes_as_vector):
* src/xfns.c (x_make_monitor_attribute_list)
(Fx_display_monitor_attributes_list):
* src/xfont.c (syms_of_xfont):
* src/xselect.c (x_handle_dnd_message):
* src/xwidget.c (save_script_callback):
Prefer make_nil_vector (N) to Fmake_vector (make_fixnum (N), Qnil).
* src/callint.c (Fcall_interactively):
* src/charset.c (load_charset_map):
* src/chartab.c (Fmake_char_table, uniprop_encode_value_numeric):
* src/composite.c (get_composition_id)
* src/dispnew.c (Fframe_or_buffer_changed_p)
(syms_of_display):
* src/fns.c (make_hash_table, maybe_resize_hash_table):
* src/font.c (font_style_to_value):
* src/fontset.c (FONTSET_ADD, fontset_add):
* src/json.c (json_to_lisp):
* src/keymap.c (syms_of_keymap):
* src/lread.c (init_obarray):
* src/profiler.c (make_log, Fprofiler_cpu_log):
* src/term.c (term_get_fkeys_1):
Prefer make_vector (N, V) to Fmake_vector (make_fixnum (N), V).
* src/font.c (build_style_table):
* src/macfont.m (macfont_shape):
* src/process.c (conv_sockaddr_to_lisp, network_interface_info):
Prefer make_uninit_vector if the vector will be initialized soon.
* src/lisp.h (make_nil_vector): New function.
Diffstat (limited to 'src/charset.c')
| -rw-r--r-- | src/charset.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/charset.c b/src/charset.c index c1a237835c7..83f4de7ed24 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -261,7 +261,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries, | |||
| 261 | { | 261 | { |
| 262 | int n = CODE_POINT_TO_INDEX (charset, max_code) + 1; | 262 | int n = CODE_POINT_TO_INDEX (charset, max_code) + 1; |
| 263 | 263 | ||
| 264 | vec = Fmake_vector (make_fixnum (n), make_fixnum (-1)); | 264 | vec = make_vector (n, make_fixnum (-1)); |
| 265 | set_charset_attr (charset, charset_decoder, vec); | 265 | set_charset_attr (charset, charset_decoder, vec); |
| 266 | } | 266 | } |
| 267 | else | 267 | else |
| @@ -856,7 +856,7 @@ usage: (define-charset-internal ...) */) | |||
| 856 | Fcons (intern ("define-charset-internal"), | 856 | Fcons (intern ("define-charset-internal"), |
| 857 | make_fixnum (nargs))); | 857 | make_fixnum (nargs))); |
| 858 | 858 | ||
| 859 | attrs = Fmake_vector (make_fixnum (charset_attr_max), Qnil); | 859 | attrs = make_nil_vector (charset_attr_max); |
| 860 | 860 | ||
| 861 | CHECK_SYMBOL (args[charset_arg_name]); | 861 | CHECK_SYMBOL (args[charset_arg_name]); |
| 862 | ASET (attrs, charset_name, args[charset_arg_name]); | 862 | ASET (attrs, charset_name, args[charset_arg_name]); |
| @@ -1563,7 +1563,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) | |||
| 1563 | 1563 | ||
| 1564 | from_byte = CHAR_TO_BYTE (from); | 1564 | from_byte = CHAR_TO_BYTE (from); |
| 1565 | 1565 | ||
| 1566 | charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil); | 1566 | charsets = make_nil_vector (charset_table_used); |
| 1567 | while (1) | 1567 | while (1) |
| 1568 | { | 1568 | { |
| 1569 | find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from, | 1569 | find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from, |
| @@ -1594,18 +1594,14 @@ If STR is unibyte, the returned list may contain | |||
| 1594 | only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) | 1594 | only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) |
| 1595 | (Lisp_Object str, Lisp_Object table) | 1595 | (Lisp_Object str, Lisp_Object table) |
| 1596 | { | 1596 | { |
| 1597 | Lisp_Object charsets; | ||
| 1598 | int i; | ||
| 1599 | Lisp_Object val; | ||
| 1600 | |||
| 1601 | CHECK_STRING (str); | 1597 | CHECK_STRING (str); |
| 1602 | 1598 | ||
| 1603 | charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil); | 1599 | Lisp_Object charsets = make_nil_vector (charset_table_used); |
| 1604 | find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str), | 1600 | find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str), |
| 1605 | charsets, table, | 1601 | charsets, table, |
| 1606 | STRING_MULTIBYTE (str)); | 1602 | STRING_MULTIBYTE (str)); |
| 1607 | val = Qnil; | 1603 | Lisp_Object val = Qnil; |
| 1608 | for (i = charset_table_used - 1; i >= 0; i--) | 1604 | for (int i = charset_table_used - 1; i >= 0; i--) |
| 1609 | if (!NILP (AREF (charsets, i))) | 1605 | if (!NILP (AREF (charsets, i))) |
| 1610 | val = Fcons (CHARSET_NAME (charset_table + i), val); | 1606 | val = Fcons (CHARSET_NAME (charset_table + i), val); |
| 1611 | return val; | 1607 | return val; |