Skip to content

Commit 500230f

Browse files
committed
Remove persistent arg from parse_encoding_array()
It is always zero.
1 parent b02b353 commit 500230f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ext/mbstring/mbstring.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,19 +441,19 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
441441
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
442442
*/
443443
static int
444-
php_mb_parse_encoding_array(HashTable *target_hash, const mbfl_encoding ***return_list, size_t *return_size, int persistent)
444+
php_mb_parse_encoding_array(HashTable *target_hash, const mbfl_encoding ***return_list, size_t *return_size)
445445
{
446446
/* Allocate enough space to include the default detect order if "auto" is used. */
447447
size_t size = zend_hash_num_elements(target_hash) + MBSTRG(default_detect_order_list_size);
448-
const mbfl_encoding **list = pecalloc(size, sizeof(mbfl_encoding*), persistent);
448+
const mbfl_encoding **list = ecalloc(size, sizeof(mbfl_encoding*));
449449
const mbfl_encoding **entry = list;
450450
zend_bool included_auto = 0;
451451
size_t n = 0;
452452
zval *hash_entry;
453453
ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
454454
zend_string *encoding_str = zval_try_get_string(hash_entry);
455455
if (UNEXPECTED(!encoding_str)) {
456-
pefree(list, persistent);
456+
efree(list);
457457
return FAILURE;
458458
}
459459

@@ -478,7 +478,7 @@ php_mb_parse_encoding_array(HashTable *target_hash, const mbfl_encoding ***retur
478478
php_error_docref(NULL, E_WARNING,
479479
"Unknown encoding \"%s\"", ZSTR_VAL(encoding_str));
480480
zend_string_release(encoding_str);
481-
pefree(list, persistent);
481+
efree(list);
482482
return FAILURE;
483483
}
484484
}
@@ -1550,7 +1550,7 @@ PHP_FUNCTION(mb_detect_order)
15501550
size_t size = 0;
15511551
switch (Z_TYPE_P(arg1)) {
15521552
case IS_ARRAY:
1553-
if (FAILURE == php_mb_parse_encoding_array(Z_ARRVAL_P(arg1), &list, &size, 0)) {
1553+
if (FAILURE == php_mb_parse_encoding_array(Z_ARRVAL_P(arg1), &list, &size)) {
15541554
RETURN_FALSE;
15551555
}
15561556
break;
@@ -2794,7 +2794,7 @@ PHP_FUNCTION(mb_convert_encoding)
27942794
}
27952795

27962796
if (from_encodings_ht) {
2797-
if (php_mb_parse_encoding_array(from_encodings_ht, &from_encodings, &num_from_encodings, 0) == FAILURE) {
2797+
if (php_mb_parse_encoding_array(from_encodings_ht, &from_encodings, &num_from_encodings) == FAILURE) {
27982798
RETURN_FALSE;
27992799
}
28002800
free_from_encodings = 1;
@@ -2980,7 +2980,7 @@ PHP_FUNCTION(mb_detect_encoding)
29802980

29812981
/* make encoding list */
29822982
if (encoding_ht) {
2983-
if (FAILURE == php_mb_parse_encoding_array(encoding_ht, &elist, &size, 0)) {
2983+
if (FAILURE == php_mb_parse_encoding_array(encoding_ht, &elist, &size)) {
29842984
RETURN_FALSE;
29852985
}
29862986
free_elist = 1;
@@ -3386,7 +3386,7 @@ PHP_FUNCTION(mb_convert_variables)
33863386

33873387
/* pre-conversion encoding */
33883388
if (from_enc_ht) {
3389-
if (php_mb_parse_encoding_array(from_enc_ht, &elist, &elistsz, 0) == FAILURE) {
3389+
if (php_mb_parse_encoding_array(from_enc_ht, &elist, &elistsz) == FAILURE) {
33903390
RETURN_FALSE;
33913391
}
33923392
} else {

0 commit comments

Comments
 (0)