Skip to content

Commit

Permalink
Use true/false instead of TRUE/FALSE in intl
Browse files Browse the repository at this point in the history
And drop the U_DEFINE_TRUE_AND_FALSE flag.
  • Loading branch information
nikic committed Nov 9, 2020
1 parent 4cd3934 commit 975735c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1893,8 +1893,6 @@ AC_DEFUN([PHP_SETUP_ICU],[
if test "$PKG_CONFIG icu-io --atleast-version=60"; then
ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"
fi
ICU_CFLAGS="$ICU_CFLAGS -DU_DEFINE_FALSE_AND_TRUE=1"
])

dnl
Expand Down
14 changes: 7 additions & 7 deletions ext/intl/breakiterator/codepointiterator_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<const CodePointBreakIterator&>(that);

if (!utext_equals(this->fText, that2.fText)) {
return FALSE;
return false;
}

return TRUE;
return true;
}

CodePointBreakIterator* CodePointBreakIterator::clone(void) const
Expand All @@ -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)
Expand All @@ -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();
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/collator/collator_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
/* }}} */

Expand Down Expand Up @@ -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 );
}
/* }}} */

Expand Down
6 changes: 3 additions & 3 deletions ext/intl/dateformat/dateformat_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions ext/intl/locale/locale_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]) )
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/normalizer/normalizer_normalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion ext/intl/timezone/timezone_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/timezone/timezone_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 975735c

Please sign in to comment.