mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
8bcd0d247e
Added kh_data_size_##name() helper function to eliminate duplicated size calculation patterns throughout the khash implementation. This single universal helper calculates data size for N elements and replaces all manual sizeof calculations. Key changes: - Add kh_data_size_##name(khint_t count) helper in KHASH_DECLARE - Replace manual calculations in kh_flags, kh_alloc_small, kh_alloc - Replace complex size calculations in kh_replace function - Use specific patterns: small tables use KHASH_SMALL_THRESHOLD, hash tables add n_buckets/4 for flag space This refactoring eliminates 6 instances of duplicated size calculation code while maintaining identical functionality and performance. Co-authored-by: Claude <noreply@anthropic.com>