ht_inc: Rename slots to slots_ (#6021)

This commit is contained in:
Khairul Azhar Kasmiran 2026-03-10 22:33:12 +08:00 committed by GitHub
parent 98670969eb
commit 690daa2f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -246,9 +246,9 @@ typedef struct Ht_(t) {
ut32 size; ///< Number of stored elements.
ut32 growth_left; ///< Number of empty slots.
RZ_BORROW ut8 *ctrl; ///< Control bytes (metadata) - point to the beginning of the `data` pointer.
RZ_BORROW HT_(Kv) *slots; ///< Main array (no buckets) - points to an offset after the `data` pointer.
RZ_BORROW HT_(Kv) *slots_; ///< Main array (no buckets) - points to an offset after the `data` pointer.
HT_(Options) opt; ///< Methods
ut8 *data; ///< Single allocation for `ctrl` and `slots` arrays.
ut8 *data; ///< Single allocation for `ctrl` and `slots_` arrays.
} HtName_(Ht);
typedef struct Ht_(iter_mut_t) {

View file

@ -61,10 +61,10 @@ typedef ut64 group_t;
// Slot addressing is different depending on whether custom elem_size is used
#ifdef HT_ENABLE_CUSTOM_ELEM_SIZE
#define HT_SLOT_AT(ht, index) \
((HT_(Kv) *)((ut8 *)(ht->slots) + index * ht->opt.elem_size))
((HT_(Kv) *)((ut8 *)(ht->slots_) + index * ht->opt.elem_size))
#else
#define HT_SLOT_AT(ht, index) \
(&(ht)->slots[(index)])
(&(ht)->slots_[(index)])
#endif
// Helper macro for implementing an unrolled foreach loop
@ -319,7 +319,7 @@ static RZ_OWN HtName_(Ht) *internal_ht_new(ut32 requested_capacity, HT_(Options)
}
ht->ctrl = ht->data;
ht->slots = (HT_(Kv) *)(ht->data + ctrl_size);
ht->slots_ = (HT_(Kv) *)(ht->data + ctrl_size);
// Initialize all slots as empty
memset(ht->ctrl, H2_STATUS_EMPTY, ctrl_size);
@ -1111,4 +1111,4 @@ RZ_API RZ_OWN RzIterator /* <HtName_(Ht)> */ *Ht_(as_iter_keys)(const RZ_NONNULL
Ht_(free_iter_state)(state);
}
return iter;
}
}