intl extension couple of micro optimisations for error edge cases. (#10044)

making c++ compile time few enums ranges.
This commit is contained in:
David CARLIER 2023-01-14 07:26:05 +00:00 committed by GitHub
parent 9788244a42
commit 690db97c6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 32 deletions

View file

@ -23,7 +23,7 @@ extern "C" {
/* {{{ intl_stringFromChar */
int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status)
{
if(str_len > INT32_MAX) {
if(UNEXPECTED(str_len > INT32_MAX)) {
*status = U_BUFFER_OVERFLOW_ERROR;
ret.setToBogus();
return FAILURE;
@ -56,7 +56,7 @@ zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status)
{
zend_string *u8res;
if (from.isBogus()) {
if (UNEXPECTED(from.isBogus())) {
return NULL;
}