Skip to content

Commit

Permalink
Merge branch 'PHP-7.4'
Browse files Browse the repository at this point in the history
* PHP-7.4:
  Remove HAVE_STRCOLL check
  • Loading branch information
petk committed Jun 27, 2019
2 parents 221494f + 638c217 commit 7f99499
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 34 deletions.
2 changes: 0 additions & 2 deletions Zend/zend_operators.c
Expand Up @@ -1944,7 +1944,6 @@ ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2) /*
}
/* }}} */

#if HAVE_STRCOLL
ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2) /* {{{ */
{
zend_string *tmp_str1, *tmp_str2;
Expand All @@ -1957,7 +1956,6 @@ ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2)
return ret;
}
/* }}} */
#endif

ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ */
{
Expand Down
2 changes: 0 additions & 2 deletions Zend/zend_operators.h
Expand Up @@ -394,9 +394,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, zend_bool case_insensitive);
ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2);
ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2);
#if HAVE_STRCOLL
ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2);
#endif

ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length);
ZEND_API char* ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length);
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Expand Up @@ -645,7 +645,6 @@ statfs \
statvfs \
std_syslog \
strcasecmp \
strcoll \
strdup \
strerror \
strnlen \
Expand Down
2 changes: 0 additions & 2 deletions ext/opcache/Optimizer/zend_func_info.c
Expand Up @@ -206,9 +206,7 @@ static const func_info_t func_infos[] = {
F1("str_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG),
#ifdef HAVE_STRCOLL
F0("strcoll", MAY_BE_LONG),
#endif
#ifdef HAVE_STRFMON
F1("money_format", MAY_BE_FALSE | MAY_BE_STRING),
#endif
Expand Down
10 changes: 0 additions & 10 deletions ext/standard/array.c
Expand Up @@ -327,7 +327,6 @@ static int php_array_reverse_key_compare_string_natural(const void *a, const voi
}
/* }}} */

#if HAVE_STRCOLL
static int php_array_key_compare_string_locale(const void *a, const void *b) /* {{{ */
{
Bucket *f = (Bucket *) a;
Expand Down Expand Up @@ -355,7 +354,6 @@ static int php_array_reverse_key_compare_string_locale(const void *a, const void
return php_array_key_compare_string_locale(b, a);
}
/* }}} */
#endif

/* Numbers are always smaller than strings int this function as it
* anyway doesn't make much sense to compare two different data types.
Expand Down Expand Up @@ -528,7 +526,6 @@ static int php_array_reverse_natural_case_compare(const void *a, const void *b)
}
/* }}} */

#if HAVE_STRCOLL
static int php_array_data_compare_string_locale(const void *a, const void *b) /* {{{ */
{
Bucket *f;
Expand Down Expand Up @@ -558,7 +555,6 @@ static int php_array_reverse_data_compare_string_locale(const void *a, const voi
return php_array_data_compare_string_locale(b, a);
}
/* }}} */
#endif

static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse) /* {{{ */
{
Expand Down Expand Up @@ -603,15 +599,13 @@ static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse)
}
break;

#if HAVE_STRCOLL
case PHP_SORT_LOCALE_STRING:
if (reverse) {
return php_array_reverse_key_compare_string_locale;
} else {
return php_array_key_compare_string_locale;
}
break;
#endif

case PHP_SORT_REGULAR:
default:
Expand Down Expand Up @@ -669,15 +663,13 @@ static compare_func_t php_get_data_compare_func(zend_long sort_type, int reverse
}
break;

#if HAVE_STRCOLL
case PHP_SORT_LOCALE_STRING:
if (reverse) {
return php_array_reverse_data_compare_string_locale;
} else {
return php_array_data_compare_string_locale;
}
break;
#endif

case PHP_SORT_REGULAR:
default:
Expand Down Expand Up @@ -5687,9 +5679,7 @@ PHP_FUNCTION(array_multisort)
case PHP_SORT_NUMERIC:
case PHP_SORT_STRING:
case PHP_SORT_NATURAL:
#if HAVE_STRCOLL
case PHP_SORT_LOCALE_STRING:
#endif
/* flag allowed here */
if (parse_state[MULTISORT_TYPE] == 1) {
/* Save the flag and make sure then next arg is not the current flag. */
Expand Down
9 changes: 2 additions & 7 deletions ext/standard/basic_functions.c
Expand Up @@ -2156,12 +2156,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
ZEND_END_ARG_INFO()
#endif

#ifdef HAVE_STRCOLL
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strcoll, IS_LONG, 0)
ZEND_ARG_INFO(0, str1)
ZEND_ARG_INFO(0, str2)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trim, 0, 1, IS_STRING, 0)
ZEND_ARG_INFO(0, str)
Expand Down Expand Up @@ -2797,10 +2795,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(substr_compare, arginfo_substr_compare)
PHP_FE(utf8_encode, arginfo_utf8_encode)
PHP_FE(utf8_decode, arginfo_utf8_decode)

#ifdef HAVE_STRCOLL
PHP_FE(strcoll, arginfo_strcoll)
#endif

#ifdef HAVE_STRFMON
PHP_FE(money_format, arginfo_money_format)
Expand Down Expand Up @@ -4133,10 +4128,10 @@ PHP_FUNCTION(getenv)
#else

tsrm_env_lock();

/* system method returns a const */
ptr = getenv(str);

if (ptr) {
RETVAL_STRING(ptr);
}
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/php_string.h
Expand Up @@ -91,9 +91,7 @@ PHP_FUNCTION(strpbrk);
PHP_FUNCTION(substr_compare);
PHP_FUNCTION(utf8_encode);
PHP_FUNCTION(utf8_decode);
#ifdef HAVE_STRCOLL
PHP_FUNCTION(strcoll);
#endif
#if HAVE_STRFMON
PHP_FUNCTION(money_format);
#endif
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/string.c
Expand Up @@ -701,7 +701,6 @@ PHP_FUNCTION(nl_langinfo)
#endif
/* }}} */

#ifdef HAVE_STRCOLL
/* {{{ proto int strcoll(string str1, string str2)
Compares two strings using the current locale */
PHP_FUNCTION(strcoll)
Expand All @@ -717,7 +716,6 @@ PHP_FUNCTION(strcoll)
(const char *) ZSTR_VAL(s2)));
}
/* }}} */
#endif

/* {{{ php_charmask
* Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strcoll.phpt
@@ -1,7 +1,5 @@
--TEST--
Testing Basic behaviour of strcoll()
--SKIPIF--
<?php if (!function_exists('strcoll')) die('skip strcoll function not available') ?>
--CREDITS--
Sebastian Schürmann
sebs@php.net
Expand Down
1 change: 0 additions & 1 deletion win32/build/config.w32
Expand Up @@ -300,7 +300,6 @@ ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));

AC_DEFINE('HAVE_USLEEP', 1);
AC_DEFINE('HAVE_STRCOLL', 1);

/* For snapshot builders, where can we find the additional
* files that make up the snapshot template? */
Expand Down
3 changes: 0 additions & 3 deletions win32/build/config.w32.h.in
Expand Up @@ -122,9 +122,6 @@
#define PHP_SHLIB_EXT_PREFIX "php_"
#define HAVE_SQLDATASOURCES

/* Win32 supports strcoll */
#define HAVE_STRCOLL 1

/* Win32 supports socketpair by the emulation in win32/sockets.c */
#define HAVE_SOCKETPAIR 1
#define HAVE_SOCKLEN_T 1
Expand Down

0 comments on commit 7f99499

Please sign in to comment.