@@ -931,23 +931,17 @@ PHPAPI void php_pcre_free_match_data(pcre2_match_data *match_data)
931
931
}/*}}}*/
932
932
933
933
static void init_unmatched_null_pair () {
934
- zval tmp ;
935
- zval * pair = & PCRE_G (unmatched_null_pair );
936
- array_init_size (pair , 2 );
937
- ZVAL_NULL (& tmp );
938
- zend_hash_next_index_insert_new (Z_ARRVAL_P (pair ), & tmp );
939
- ZVAL_LONG (& tmp , -1 );
940
- zend_hash_next_index_insert_new (Z_ARRVAL_P (pair ), & tmp );
934
+ zval val1 , val2 ;
935
+ ZVAL_NULL (& val1 );
936
+ ZVAL_LONG (& val2 , -1 );
937
+ ZVAL_ARR (& PCRE_G (unmatched_null_pair ), zend_new_pair (& val1 , & val2 ));
941
938
}
942
939
943
940
static void init_unmatched_empty_pair () {
944
- zval tmp ;
945
- zval * pair = & PCRE_G (unmatched_empty_pair );
946
- array_init_size (pair , 2 );
947
- ZVAL_EMPTY_STRING (& tmp );
948
- zend_hash_next_index_insert_new (Z_ARRVAL_P (pair ), & tmp );
949
- ZVAL_LONG (& tmp , -1 );
950
- zend_hash_next_index_insert_new (Z_ARRVAL_P (pair ), & tmp );
941
+ zval val1 , val2 ;
942
+ ZVAL_EMPTY_STRING (& val1 );
943
+ ZVAL_LONG (& val2 , -1 );
944
+ ZVAL_ARR (& PCRE_G (unmatched_empty_pair ), zend_new_pair (& val1 , & val2 ));
951
945
}
952
946
953
947
static zend_always_inline void populate_match_value_str (
@@ -980,7 +974,7 @@ static inline void add_offset_pair(
980
974
zval * result , const char * subject , PCRE2_SIZE start_offset , PCRE2_SIZE end_offset ,
981
975
zend_string * name , uint32_t unmatched_as_null )
982
976
{
983
- zval match_pair , tmp ;
977
+ zval match_pair ;
984
978
985
979
/* Add (match, offset) to the return value */
986
980
if (PCRE2_UNSET == start_offset ) {
@@ -996,11 +990,10 @@ static inline void add_offset_pair(
996
990
ZVAL_COPY (& match_pair , & PCRE_G (unmatched_empty_pair ));
997
991
}
998
992
} else {
999
- array_init_size (& match_pair , 2 );
1000
- populate_match_value_str (& tmp , subject , start_offset , end_offset );
1001
- zend_hash_next_index_insert_new (Z_ARRVAL (match_pair ), & tmp );
1002
- ZVAL_LONG (& tmp , start_offset );
1003
- zend_hash_next_index_insert_new (Z_ARRVAL (match_pair ), & tmp );
993
+ zval val1 , val2 ;
994
+ populate_match_value_str (& val1 , subject , start_offset , end_offset );
995
+ ZVAL_LONG (& val2 , start_offset );
996
+ ZVAL_ARR (& match_pair , zend_new_pair (& val1 , & val2 ));
1004
997
}
1005
998
1006
999
if (name ) {
0 commit comments