diff options
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/charset.c b/src/charset.c index 3aa105e57bd..4bacc011e85 100644 --- a/src/charset.c +++ b/src/charset.c @@ -850,7 +850,6 @@ usage: (define-charset-internal ...) */) /* Charset attr vector. */ Lisp_Object attrs; Lisp_Object val; - Lisp_Object hash_code; struct Lisp_Hash_Table *hash_table = XHASH_TABLE (Vcharset_hash_table); int i, j; struct charset charset; @@ -1108,18 +1107,19 @@ usage: (define-charset-internal ...) */) CHECK_LIST (args[charset_arg_plist]); ASET (attrs, charset_plist, args[charset_arg_plist]); - charset.hash_index = hash_lookup (hash_table, args[charset_arg_name], - &hash_code); - if (charset.hash_index >= 0) + hash_hash_t hash_code; + ptrdiff_t hash_index + = hash_lookup_get_hash (hash_table, args[charset_arg_name], + &hash_code); + if (hash_index >= 0) { - new_definition_p = 0; + new_definition_p = false; id = XFIXNAT (CHARSET_SYMBOL_ID (args[charset_arg_name])); - set_hash_value_slot (hash_table, charset.hash_index, attrs); + set_hash_value_slot (hash_table, hash_index, attrs); } else { - charset.hash_index = hash_put (hash_table, args[charset_arg_name], attrs, - hash_code); + hash_put (hash_table, args[charset_arg_name], attrs, hash_code); if (charset_table_used == charset_table_size) { /* Ensure that charset IDs fit into 'int' as well as into the @@ -1150,6 +1150,7 @@ usage: (define-charset-internal ...) */) ASET (attrs, charset_id, make_fixnum (id)); charset.id = id; + charset.attributes = attrs; charset_table[id] = charset; if (charset.method == CHARSET_METHOD_MAP) @@ -1790,7 +1791,7 @@ encode_char (struct charset *charset, int c) return CHARSET_INVALID_CODE (charset); } - if (! CHARSET_FAST_MAP_REF ((c), charset->fast_map) + if (! CHARSET_FAST_MAP_REF (c, charset->fast_map) || c < CHARSET_MIN_CHAR (charset) || c > CHARSET_MAX_CHAR (charset)) return CHARSET_INVALID_CODE (charset); @@ -2269,6 +2270,15 @@ See also `charset-priority-list' and `set-charset-priority'. */) return charsets; } +/* Not strictly necessary, because all charset attributes are also + reachable from `Vcharset_hash_table`. */ +void +mark_charset (void) +{ + for (int i = 0; i < charset_table_used; i++) + mark_object (charset_table[i].attributes); +} + void init_charset (void) |