48
48
49
49
#ifdef __SSE2__
50
50
#include <emmintrin.h>
51
+ #include "Zend/zend_bitset.h"
51
52
#endif
52
53
53
54
/* this is read-only, so it's ok */
@@ -3472,15 +3473,10 @@ PHPAPI zend_string *php_addcslashes(zend_string *str, const char *what, size_t w
3472
3473
ZEND_INTRIN_SSE4_2_FUNC_DECL (zend_string * php_addslashes_sse42 (zend_string * str ));
3473
3474
zend_string * php_addslashes_default (zend_string * str );
3474
3475
3475
- ZEND_INTRIN_SSE4_2_FUNC_DECL (void php_stripslashes_sse42 (zend_string * str ));
3476
- void php_stripslashes_default (zend_string * str );
3477
-
3478
3476
# ifdef ZEND_INTRIN_SSE4_2_FUNC_PROTO
3479
3477
PHPAPI zend_string * php_addslashes (zend_string * str ) __attribute__((ifunc ("resolve_addslashes" )));
3480
- PHPAPI void php_stripslashes (zend_string * str ) __attribute__((ifunc ("resolve_stripslashes" )));
3481
3478
3482
3479
typedef zend_string * (* php_addslashes_func_t )(zend_string * );
3483
- typedef void (* php_stripslashes_func_t )(zend_string * );
3484
3480
3485
3481
ZEND_NO_SANITIZE_ADDRESS
3486
3482
ZEND_ATTRIBUTE_UNUSED /* clang mistakenly warns about this */
@@ -3490,36 +3486,21 @@ static php_addslashes_func_t resolve_addslashes(void) {
3490
3486
}
3491
3487
return php_addslashes_default ;
3492
3488
}
3493
-
3494
- ZEND_NO_SANITIZE_ADDRESS
3495
- ZEND_ATTRIBUTE_UNUSED /* clang mistakenly warns about this */
3496
- static php_stripslashes_func_t resolve_stripslashes (void ) {
3497
- if (zend_cpu_supports_sse42 ()) {
3498
- return php_stripslashes_sse42 ;
3499
- }
3500
- return php_stripslashes_default ;
3501
- }
3502
3489
# else /* ZEND_INTRIN_SSE4_2_FUNC_PTR */
3503
3490
3504
3491
static zend_string * (* php_addslashes_ptr )(zend_string * str ) = NULL ;
3505
- static void (* php_stripslashes_ptr )(zend_string * str ) = NULL ;
3506
3492
3507
3493
PHPAPI zend_string * php_addslashes (zend_string * str ) {
3508
3494
return php_addslashes_ptr (str );
3509
3495
}
3510
- PHPAPI void php_stripslashes (zend_string * str ) {
3511
- php_stripslashes_ptr (str );
3512
- }
3513
3496
3514
3497
/* {{{ PHP_MINIT_FUNCTION */
3515
3498
PHP_MINIT_FUNCTION (string_intrin )
3516
3499
{
3517
3500
if (zend_cpu_supports_sse42 ()) {
3518
3501
php_addslashes_ptr = php_addslashes_sse42 ;
3519
- php_stripslashes_ptr = php_stripslashes_sse42 ;
3520
3502
} else {
3521
3503
php_addslashes_ptr = php_addslashes_default ;
3522
- php_stripslashes_ptr = php_stripslashes_default ;
3523
3504
}
3524
3505
return SUCCESS ;
3525
3506
}
@@ -3872,12 +3853,8 @@ static zend_always_inline char *php_stripslashes_impl(const char *str, char *out
3872
3853
return out ;
3873
3854
}
3874
3855
3875
- #if defined(ZEND_INTRIN_SSE4_2_NATIVE ) || defined(ZEND_INTRIN_SSE4_2_RESOLVER )
3876
- # ifdef ZEND_INTRIN_SSE4_2_NATIVE
3856
+ #ifdef __SSE2__
3877
3857
PHPAPI void php_stripslashes (zend_string * str )
3878
- # elif defined(ZEND_INTRIN_SSE4_2_RESOLVER )
3879
- void php_stripslashes_sse42 (zend_string * str )
3880
- # endif
3881
3858
{
3882
3859
const char * s = ZSTR_VAL (str );
3883
3860
char * t = ZSTR_VAL (str );
@@ -3928,22 +3905,15 @@ void php_stripslashes_sse42(zend_string *str)
3928
3905
ZSTR_VAL (str )[ZSTR_LEN (str )] = '\0' ;
3929
3906
}
3930
3907
}
3931
- #endif
3932
-
3933
- #ifndef ZEND_INTRIN_SSE4_2_NATIVE
3934
- # ifdef ZEND_INTRIN_SSE4_2_RESOLVER
3935
- void php_stripslashes_default (zend_string * str ) /* {{{ */
3936
- # else
3908
+ #else
3937
3909
PHPAPI void php_stripslashes (zend_string * str )
3938
- # endif
3939
3910
{
3940
3911
const char * t = php_stripslashes_impl (ZSTR_VAL (str ), ZSTR_VAL (str ), ZSTR_LEN (str ));
3941
3912
if (t != (ZSTR_VAL (str ) + ZSTR_LEN (str ))) {
3942
3913
ZSTR_LEN (str ) = t - ZSTR_VAL (str );
3943
3914
ZSTR_VAL (str )[ZSTR_LEN (str )] = '\0' ;
3944
3915
}
3945
3916
}
3946
- /* }}} */
3947
3917
#endif
3948
3918
/* }}} */
3949
3919
0 commit comments