Skip to content

Commit 638c217

Browse files
committed
Remove HAVE_STRCOLL check
The strcoll function is defined in the C89 standard and should be on today's systems always available via the <string.h> header. https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3 - Remove also SKIPIF strcoll check in test
1 parent 033cafa commit 638c217

File tree

11 files changed

+2
-34
lines changed

11 files changed

+2
-34
lines changed

Zend/zend_operators.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,6 @@ ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2) /*
19691969
}
19701970
/* }}} */
19711971

1972-
#if HAVE_STRCOLL
19731972
ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2) /* {{{ */
19741973
{
19751974
zend_string *tmp_str1, *tmp_str2;
@@ -1982,7 +1981,6 @@ ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2)
19821981
return ret;
19831982
}
19841983
/* }}} */
1985-
#endif
19861984

19871985
ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ */
19881986
{

Zend/zend_operators.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,7 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
394394
ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, zend_bool case_insensitive);
395395
ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2);
396396
ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2);
397-
#if HAVE_STRCOLL
398397
ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2);
399-
#endif
400398

401399
ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length);
402400
ZEND_API char* ZEND_FASTCALL zend_str_tolower_copy(char *dest, const char *source, size_t length);

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ statfs \
644644
statvfs \
645645
std_syslog \
646646
strcasecmp \
647-
strcoll \
648647
strdup \
649648
strerror \
650649
strnlen \

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,7 @@ static const func_info_t func_infos[] = {
335335
F1("str_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
336336
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
337337
F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG),
338-
#ifdef HAVE_STRCOLL
339338
F0("strcoll", MAY_BE_NULL | MAY_BE_LONG),
340-
#endif
341339
#ifdef HAVE_STRFMON
342340
F1("money_format", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
343341
#endif

ext/standard/array.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ static int php_array_reverse_key_compare_string_natural(const void *a, const voi
327327
}
328328
/* }}} */
329329

330-
#if HAVE_STRCOLL
331330
static int php_array_key_compare_string_locale(const void *a, const void *b) /* {{{ */
332331
{
333332
Bucket *f = (Bucket *) a;
@@ -355,7 +354,6 @@ static int php_array_reverse_key_compare_string_locale(const void *a, const void
355354
return php_array_key_compare_string_locale(b, a);
356355
}
357356
/* }}} */
358-
#endif
359357

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

531-
#if HAVE_STRCOLL
532529
static int php_array_data_compare_string_locale(const void *a, const void *b) /* {{{ */
533530
{
534531
Bucket *f;
@@ -558,7 +555,6 @@ static int php_array_reverse_data_compare_string_locale(const void *a, const voi
558555
return php_array_data_compare_string_locale(b, a);
559556
}
560557
/* }}} */
561-
#endif
562558

563559
static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse) /* {{{ */
564560
{
@@ -603,15 +599,13 @@ static compare_func_t php_get_key_compare_func(zend_long sort_type, int reverse)
603599
}
604600
break;
605601

606-
#if HAVE_STRCOLL
607602
case PHP_SORT_LOCALE_STRING:
608603
if (reverse) {
609604
return php_array_reverse_key_compare_string_locale;
610605
} else {
611606
return php_array_key_compare_string_locale;
612607
}
613608
break;
614-
#endif
615609

616610
case PHP_SORT_REGULAR:
617611
default:
@@ -669,15 +663,13 @@ static compare_func_t php_get_data_compare_func(zend_long sort_type, int reverse
669663
}
670664
break;
671665

672-
#if HAVE_STRCOLL
673666
case PHP_SORT_LOCALE_STRING:
674667
if (reverse) {
675668
return php_array_reverse_data_compare_string_locale;
676669
} else {
677670
return php_array_data_compare_string_locale;
678671
}
679672
break;
680-
#endif
681673

682674
case PHP_SORT_REGULAR:
683675
default:
@@ -5709,9 +5701,7 @@ PHP_FUNCTION(array_multisort)
57095701
case PHP_SORT_NUMERIC:
57105702
case PHP_SORT_STRING:
57115703
case PHP_SORT_NATURAL:
5712-
#if HAVE_STRCOLL
57135704
case PHP_SORT_LOCALE_STRING:
5714-
#endif
57155705
/* flag allowed here */
57165706
if (parse_state[MULTISORT_TYPE] == 1) {
57175707
/* Save the flag and make sure then next arg is not the current flag. */

ext/standard/basic_functions.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,12 +2162,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
21622162
ZEND_END_ARG_INFO()
21632163
#endif
21642164

2165-
#ifdef HAVE_STRCOLL
21662165
ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0)
21672166
ZEND_ARG_INFO(0, str1)
21682167
ZEND_ARG_INFO(0, str2)
21692168
ZEND_END_ARG_INFO()
2170-
#endif
21712169

21722170
ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1)
21732171
ZEND_ARG_INFO(0, str)
@@ -2803,10 +2801,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
28032801
PHP_FE(substr_compare, arginfo_substr_compare)
28042802
PHP_FE(utf8_encode, arginfo_utf8_encode)
28052803
PHP_FE(utf8_decode, arginfo_utf8_decode)
2806-
2807-
#ifdef HAVE_STRCOLL
28082804
PHP_FE(strcoll, arginfo_strcoll)
2809-
#endif
28102805

28112806
#ifdef HAVE_STRFMON
28122807
PHP_FE(money_format, arginfo_money_format)
@@ -4140,10 +4135,10 @@ PHP_FUNCTION(getenv)
41404135
#else
41414136

41424137
tsrm_env_lock();
4143-
4138+
41444139
/* system method returns a const */
41454140
ptr = getenv(str);
4146-
4141+
41474142
if (ptr) {
41484143
RETVAL_STRING(ptr);
41494144
}

ext/standard/php_string.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ PHP_FUNCTION(strpbrk);
9191
PHP_FUNCTION(substr_compare);
9292
PHP_FUNCTION(utf8_encode);
9393
PHP_FUNCTION(utf8_decode);
94-
#ifdef HAVE_STRCOLL
9594
PHP_FUNCTION(strcoll);
96-
#endif
9795
#if HAVE_STRFMON
9896
PHP_FUNCTION(money_format);
9997
#endif

ext/standard/string.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ PHP_FUNCTION(nl_langinfo)
701701
#endif
702702
/* }}} */
703703

704-
#ifdef HAVE_STRCOLL
705704
/* {{{ proto int strcoll(string str1, string str2)
706705
Compares two strings using the current locale */
707706
PHP_FUNCTION(strcoll)
@@ -717,7 +716,6 @@ PHP_FUNCTION(strcoll)
717716
(const char *) ZSTR_VAL(s2)));
718717
}
719718
/* }}} */
720-
#endif
721719

722720
/* {{{ php_charmask
723721
* Fills a 256-byte bytemask with input. You can specify a range like 'a..z',

ext/standard/tests/strings/strcoll.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Testing Basic behaviour of strcoll()
3-
--SKIPIF--
4-
<?php if (!function_exists('strcoll')) die('skip strcoll function not available') ?>
53
--CREDITS--
64
Sebastian Schürmann
75

win32/build/config.w32

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
300300
ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
301301

302302
AC_DEFINE('HAVE_USLEEP', 1);
303-
AC_DEFINE('HAVE_STRCOLL', 1);
304303

305304
/* For snapshot builders, where can we find the additional
306305
* files that make up the snapshot template? */

0 commit comments

Comments
 (0)