Skip to content

Commit 06da048

Browse files
committed
Use HashTable directly instead of zval
1 parent 69b1f3d commit 06da048

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

ext/zip/php_zip.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ typedef struct {
334334
#endif
335335
} zip_options;
336336

337-
static int php_zip_parse_options(zval *options, zip_options *opts)
337+
static int php_zip_parse_options(HashTable *options, zip_options *opts)
338338
/* {{{ */
339339
{
340340
zval *option;
@@ -347,23 +347,23 @@ static int php_zip_parse_options(zval *options, zip_options *opts)
347347
opts->enc_method = -1; /* -1 to not change default */
348348
#endif
349349

350-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {
350+
if ((option = zend_hash_str_find(options, "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {
351351
opts->remove_all_path = zval_get_long(option);
352352
}
353353

354-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "comp_method", sizeof("comp_method") - 1)) != NULL) {
354+
if ((option = zend_hash_str_find(options, "comp_method", sizeof("comp_method") - 1)) != NULL) {
355355
opts->comp_method = zval_get_long(option);
356356

357-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "comp_flags", sizeof("comp_flags") - 1)) != NULL) {
357+
if ((option = zend_hash_str_find(options, "comp_flags", sizeof("comp_flags") - 1)) != NULL) {
358358
opts->comp_flags = zval_get_long(option);
359359
}
360360
}
361361

362362
#ifdef HAVE_ENCRYPTION
363-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "enc_method", sizeof("enc_method") - 1)) != NULL) {
363+
if ((option = zend_hash_str_find(options, "enc_method", sizeof("enc_method") - 1)) != NULL) {
364364
opts->enc_method = zval_get_long(option);
365365

366-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "enc_password", sizeof("enc_password") - 1)) != NULL) {
366+
if ((option = zend_hash_str_find(options, "enc_password", sizeof("enc_password") - 1)) != NULL) {
367367
if (Z_TYPE_P(option) != IS_STRING) {
368368
php_error_docref(NULL, E_WARNING, "enc_password option expected to be a string");
369369
return -1;
@@ -373,7 +373,7 @@ static int php_zip_parse_options(zval *options, zip_options *opts)
373373
}
374374
#endif
375375

376-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "remove_path", sizeof("remove_path") - 1)) != NULL) {
376+
if ((option = zend_hash_str_find(options, "remove_path", sizeof("remove_path") - 1)) != NULL) {
377377
if (Z_TYPE_P(option) != IS_STRING) {
378378
php_error_docref(NULL, E_WARNING, "remove_path option expected to be a string");
379379
return -1;
@@ -393,7 +393,7 @@ static int php_zip_parse_options(zval *options, zip_options *opts)
393393
opts->remove_path = Z_STRVAL_P(option);
394394
}
395395

396-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "add_path", sizeof("add_path") - 1)) != NULL) {
396+
if ((option = zend_hash_str_find(options, "add_path", sizeof("add_path") - 1)) != NULL) {
397397
if (Z_TYPE_P(option) != IS_STRING) {
398398
php_error_docref(NULL, E_WARNING, "add_path option expected to be a string");
399399
return -1;
@@ -413,7 +413,7 @@ static int php_zip_parse_options(zval *options, zip_options *opts)
413413
opts->add_path = Z_STRVAL_P(option);
414414
}
415415

416-
if ((option = zend_hash_str_find(Z_ARRVAL_P(options), "flags", sizeof("flags") - 1)) != NULL) {
416+
if ((option = zend_hash_str_find(options, "flags", sizeof("flags") - 1)) != NULL) {
417417
if (Z_TYPE_P(option) != IS_LONG) {
418418
php_error_docref(NULL, E_WARNING, "flags option expected to be a integer");
419419
return -1;
@@ -1658,19 +1658,19 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
16581658
char *path = ".";
16591659
size_t path_len = 1;
16601660
zend_long glob_flags = 0;
1661-
zval *options = NULL;
1661+
HashTable *options = NULL;
16621662
zip_options opts;
16631663
int found;
16641664
zend_string *pattern;
16651665

16661666
/* 1 == glob, 2 == pcre */
16671667
if (type == 1) {
1668-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|la",
1668+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|lh",
16691669
&pattern, &glob_flags, &options) == FAILURE) {
16701670
RETURN_THROWS();
16711671
}
16721672
} else {
1673-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|sa",
1673+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|sh",
16741674
&pattern, &path, &path_len, &options) == FAILURE) {
16751675
RETURN_THROWS();
16761676
}
@@ -1680,7 +1680,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
16801680
php_error_docref(NULL, E_NOTICE, "Empty string as pattern");
16811681
RETURN_FALSE;
16821682
}
1683-
if (options && zend_hash_num_elements(Z_ARRVAL_P(options)) > 0 && (php_zip_parse_options(options, &opts) < 0)) {
1683+
if (options && zend_hash_num_elements(options) > 0 && (php_zip_parse_options(options, &opts) < 0)) {
16841684
RETURN_FALSE;
16851685
}
16861686

0 commit comments

Comments
 (0)