ruby-changes:54485
From: ko1 <ko1@a...>
Date: Fri, 4 Jan 2019 10:59:55 +0900 (JST)
Subject: [ruby-changes:54485] ko1:r66700 (trunk): ar_table_entry::hash should be `st_hash_t`.
ko1 2019-01-04 10:59:49 +0900 (Fri, 04 Jan 2019) New Revision: 66700 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66700 Log: ar_table_entry::hash should be `st_hash_t`. * hash.c: the type of `ar_table_entry::hash` is not a `VALUE`, but a `st_hash_t`. Also `st_hash_t` is not a `st_data_t`, but `st_index_t` (same as st.c). Modified files: trunk/hash.c Index: hash.c =================================================================== --- hash.c (revision 66699) +++ hash.c (revision 66700) @@ -48,35 +48,6 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L48 #define COPY_DEFAULT(hash, hash2) copy_default(RHASH(hash), RHASH(hash2)) -/* - * RHASH_AR_TABLE_P(h): - * * as.ar == NULL or - * as.ar points ar_table. - * * as.ar is allocated by transient heap or xmalloc. - * - * !RHASH_AR_TABLE_P(h): - * * as.st points st_table. - */ - -#define RHASH_AR_TABLE_MAX_SIZE 8 -#define RHASH_AR_TABLE_MAX_BOUND RHASH_AR_TABLE_MAX_SIZE - -typedef struct ar_table_entry { - VALUE hash; - VALUE key; - VALUE record; -} ar_table_entry; - -typedef struct ar_table_struct { - ar_table_entry entries[RHASH_AR_TABLE_MAX_SIZE]; -} ar_table; - -size_t -rb_hash_ar_table_size(void) -{ - return sizeof(ar_table); -} - static inline void copy_default(struct RHash *hash, const struct RHash *hash2) { @@ -347,10 +318,39 @@ static const struct st_hash_type identha https://github.com/ruby/ruby/blob/trunk/hash.c#L318 #define SET_HASH(entry, _hash) (entry)->hash = (_hash) #define SET_RECORD(entry, _value) (entry)->record = (_value) -typedef st_data_t st_hash_t; +typedef st_index_t st_hash_t; extern const st_hash_t st_reserved_hash_val; extern const st_hash_t st_reserved_hash_substitution_val; +/* + * RHASH_AR_TABLE_P(h): + * * as.ar == NULL or + * as.ar points ar_table. + * * as.ar is allocated by transient heap or xmalloc. + * + * !RHASH_AR_TABLE_P(h): + * * as.st points st_table. + */ + +#define RHASH_AR_TABLE_MAX_SIZE 8 +#define RHASH_AR_TABLE_MAX_BOUND RHASH_AR_TABLE_MAX_SIZE + +typedef struct ar_table_entry { + st_hash_t hash; + VALUE key; + VALUE record; +} ar_table_entry; + +typedef struct ar_table_struct { + ar_table_entry entries[RHASH_AR_TABLE_MAX_SIZE]; +} ar_table; + +size_t +rb_hash_ar_table_size(void) +{ + return sizeof(ar_table); +} + static inline st_hash_t do_hash(st_data_t key) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/