[php-src] PR #22483: ext/intl: Pre-size arrays created from ICU enumerations
| From: | kn1g78 | Date: | Sat, 27 Jun 2026 07:24:42 +0000 |
| Subject: | [php-src] PR #22483: ext/intl: Pre-size arrays created from ICU enumerations | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36689@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22483
Author: kn1g78
Use
uenum_count() to pre-size arrays built from ICU enumerations.
This avoids unnecessary HashTable growth in transliterator_list_ids(),
resourcebundle_locales() and locale_get_keywords().
locale_get_keywords() also uses the keyword length reported by ICU when
inserting the associative entry, with a fallback to strlen() for unknown
lengths.
If counting fails, the previous behavior is preserved by falling back to an
unsized array initialization.