Except for arginfo header as PHP_FUNCTION/PHP_METHOD are marked as U_CFUNC and the `ext/date/php_date.h` header doesn't use extern C.
We now specificy the header symbols that _need_ to follow the C function ABI, meaning in some places we drop U_CFUNC declarations and in others we add it.
Also use the `BEGIN_EXTERN_C()` portability macro when possible so that searching for this is easier.
Introduce PHP_INTL_FUNCTION_WITH_ERROR_RESET macro to standardize
and automate the global Intl error state reset at the start of
every userland PHP_FUNCTION. Also change the IC_METHOD function
to automatically reset error state in the start of the defined function.
The macro wraps the function entry point, performs
intl_error_reset(NULL), and delegates the actual logic to a
separate _impl function. This reduces boilerplate and prevents
bugs caused by missing error resets, as seen in GH-22931 and
GH-22500.
This refactor applies to all functions with a manual reset call
and does not affect internal helper functions that handle errors
independently.
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.