From 975735c02751d9409c4a4757e7b70d217f0f54fe Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 9 Nov 2020 14:44:11 +0100 Subject: [PATCH] Use true/false instead of TRUE/FALSE in intl And drop the U_DEFINE_TRUE_AND_FALSE flag. --- build/php.m4 | 2 -- .../breakiterator/codepointiterator_internal.cpp | 14 +++++++------- ext/intl/collator/collator_sort.c | 4 ++-- ext/intl/dateformat/dateformat_attr.c | 6 +++--- ext/intl/locale/locale_methods.c | 4 ++-- ext/intl/normalizer/normalizer_normalize.c | 4 ++-- ext/intl/timezone/timezone_class.cpp | 2 +- ext/intl/timezone/timezone_methods.cpp | 2 +- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git ext/intl/breakiterator/codepointiterator_internal.cpp ext/intl/breakiterator/codepointiterator_internal.cpp index 082c02d8b2d2..754e0b01d601 100644 --- ext/intl/breakiterator/codepointiterator_internal.cpp +++ ext/intl/breakiterator/codepointiterator_internal.cpp @@ -56,7 +56,7 @@ CodePointBreakIterator& CodePointBreakIterator::operator=(const CodePointBreakIt return *this; } - this->fText = utext_clone(this->fText, that.fText, FALSE, TRUE, &uec); + this->fText = utext_clone(this->fText, that.fText, false, true, &uec); //don't bother copying the character iterator, getText() is deprecated clearCurrentCharIter(); @@ -76,17 +76,17 @@ CodePointBreakIterator::~CodePointBreakIterator() UBool CodePointBreakIterator::operator==(const BreakIterator& that) const { if (typeid(*this) != typeid(that)) { - return FALSE; + return false; } const CodePointBreakIterator& that2 = static_cast(that); if (!utext_equals(this->fText, that2.fText)) { - return FALSE; + return false; } - return TRUE; + return true; } CodePointBreakIterator* CodePointBreakIterator::clone(void) const @@ -107,7 +107,7 @@ CharacterIterator& CodePointBreakIterator::getText(void) const UText *CodePointBreakIterator::getUText(UText *fillIn, UErrorCode &status) const { - return utext_clone(fillIn, this->fText, FALSE, TRUE, &status); + return utext_clone(fillIn, this->fText, false, true, &status); } void CodePointBreakIterator::setText(const UnicodeString &text) @@ -126,7 +126,7 @@ void CodePointBreakIterator::setText(UText *text, UErrorCode &status) return; } - this->fText = utext_clone(this->fText, text, FALSE, TRUE, &status); + this->fText = utext_clone(this->fText, text, false, true, &status); clearCurrentCharIter(); } @@ -278,7 +278,7 @@ CodePointBreakIterator &CodePointBreakIterator::refreshInputText(UText *input, U } int64_t pos = utext_getNativeIndex(this->fText); - this->fText = utext_clone(this->fText, input, FALSE, TRUE, &status); + this->fText = utext_clone(this->fText, input, false, true, &status); if (U_FAILURE(status)) { return *this; } diff --git ext/intl/collator/collator_sort.c ext/intl/collator/collator_sort.c index b2da7e16fe25..5989ef42b2e6 100644 --- ext/intl/collator/collator_sort.c +++ ext/intl/collator/collator_sort.c @@ -312,7 +312,7 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS ) /* {{{ Sort array using specified collator. */ PHP_FUNCTION( collator_sort ) { - collator_sort_internal( TRUE, INTERNAL_FUNCTION_PARAM_PASSTHRU ); + collator_sort_internal( true, INTERNAL_FUNCTION_PARAM_PASSTHRU ); } /* }}} */ @@ -495,7 +495,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) /* {{{ Sort array using specified collator, maintaining index association. */ PHP_FUNCTION( collator_asort ) { - collator_sort_internal( FALSE, INTERNAL_FUNCTION_PARAM_PASSTHRU ); + collator_sort_internal( false, INTERNAL_FUNCTION_PARAM_PASSTHRU ); } /* }}} */ diff --git ext/intl/dateformat/dateformat_attr.c ext/intl/dateformat/dateformat_attr.c index 7f67afe5b3ca..2d2dbdfb6ccc 100644 --- ext/intl/dateformat/dateformat_attr.c +++ ext/intl/dateformat/dateformat_attr.c @@ -69,7 +69,7 @@ PHP_FUNCTION( datefmt_get_pattern ) UChar value_buf[64]; uint32_t length = USIZE( value_buf ); UChar* value = value_buf; - zend_bool is_pattern_localized =FALSE; + zend_bool is_pattern_localized = false; DATE_FORMAT_METHOD_INIT_VARS; @@ -106,7 +106,7 @@ PHP_FUNCTION( datefmt_set_pattern ) size_t value_len = 0; int32_t slength = 0; UChar* svalue = NULL; - zend_bool is_pattern_localized =FALSE; + zend_bool is_pattern_localized = false; DATE_FORMAT_METHOD_INIT_VARS; @@ -184,7 +184,7 @@ PHP_FUNCTION( datefmt_is_lenient ) /* {{{ Set formatter lenient. */ PHP_FUNCTION( datefmt_set_lenient ) { - zend_bool isLenient = FALSE; + zend_bool isLenient = false; DATE_FORMAT_METHOD_INIT_VARS; diff --git ext/intl/locale/locale_methods.c ext/intl/locale/locale_methods.c index 466dafadaced..9357475f5515 100644 --- ext/intl/locale/locale_methods.c +++ ext/intl/locale/locale_methods.c @@ -83,14 +83,14 @@ static const char * const LOC_PREFERRED_GRANDFATHERED[] = { NULL }; -/*returns TRUE if a is an ID separator FALSE otherwise*/ +/* returns true if a is an ID separator, false otherwise */ #define isIDSeparator(a) (a == '_' || a == '-') #define isKeywordSeparator(a) (a == '@' ) #define isEndOfTag(a) (a == '\0' ) #define isPrefixLetter(a) ((a=='x')||(a=='X')||(a=='i')||(a=='I')) -/*returns TRUE if one of the special prefixes is here (s=string) +/*returns true if one of the special prefixes is here (s=string) 'x-' or 'i-' */ #define isIDPrefix(s) (isPrefixLetter(s[0])&&isIDSeparator(s[1])) #define isKeywordPrefix(s) ( isKeywordSeparator(s[0]) ) diff --git ext/intl/normalizer/normalizer_normalize.c ext/intl/normalizer/normalizer_normalize.c index 5eca379c9905..edeeea7f4be1 100644 --- ext/intl/normalizer/normalizer_normalize.c +++ ext/intl/normalizer/normalizer_normalize.c @@ -69,7 +69,7 @@ static UBool intl_is_normalized(zend_long form, const UChar *uinput, int32_t uin const UNormalizer2 *norm = intl_get_normalizer(form, err); if(U_FAILURE(*err)) { - return FALSE; + return false; } return unorm2_isNormalized(norm, uinput, uinput_len, err); @@ -226,7 +226,7 @@ PHP_FUNCTION( normalizer_is_normalized ) int uinput_len = 0; UErrorCode status = U_ZERO_ERROR; - UBool uret = FALSE; + UBool uret = false; intl_error_reset( NULL ); diff --git ext/intl/timezone/timezone_class.cpp ext/intl/timezone/timezone_class.cpp index 63d5b057467f..f5749fd621de 100644 --- ext/intl/timezone/timezone_class.cpp +++ ext/intl/timezone/timezone_class.cpp @@ -327,7 +327,7 @@ static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp) int32_t rawOffset, dstOffset; UDate now = Calendar::getNow(); - tz->getOffset(now, FALSE, rawOffset, dstOffset, uec); + tz->getOffset(now, false, rawOffset, dstOffset, uec); if (U_FAILURE(uec)) { return debug_info; } diff --git ext/intl/timezone/timezone_methods.cpp ext/intl/timezone/timezone_methods.cpp index 6516bb6ff79e..3a2d28ada6fe 100644 --- ext/intl/timezone/timezone_methods.cpp +++ ext/intl/timezone/timezone_methods.cpp @@ -89,7 +89,7 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone) RETURN_NULL(); } - tz = timezone_convert_datetimezone(tzobj->type, tzobj, FALSE, NULL, + tz = timezone_convert_datetimezone(tzobj->type, tzobj, false, NULL, "intltz_from_date_time_zone"); if (tz == NULL) { RETURN_NULL();