Skip to content

Commit d486d65

Browse files
committed
ext/phar: Reduce scope of some variables
1 parent 6adffeb commit d486d65

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ext/phar/phar.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
25462546
php_stream_filter *filter;
25472547
php_serialize_data_t metadata_hash;
25482548
smart_str main_metadata_str = {0};
2549-
int free_user_stub, free_fp = 1, free_ufp = 1;
2549+
int free_fp = 1, free_ufp = 1;
25502550
int manifest_hack = 0;
25512551
php_stream *shared_cfp = NULL;
25522552

@@ -2600,6 +2600,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
26002600

26012601
if (user_stub) {
26022602
zend_string *suser_stub;
2603+
bool free_user_stub = false;
2604+
26032605
if (len < 0) {
26042606
/* resource passed in */
26052607
if (!(php_stream_from_zval_no_verify(stubfile, (zval *)user_stub))) {
@@ -2629,12 +2631,11 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
26292631
}
26302632
return EOF;
26312633
}
2632-
free_user_stub = 1;
2634+
free_user_stub = true;
26332635
user_stub = ZSTR_VAL(suser_stub);
26342636
len = ZSTR_LEN(suser_stub);
2635-
} else {
2636-
free_user_stub = 0;
26372637
}
2638+
26382639
if ((pos = php_stristr(user_stub, halt_stub, len, sizeof(halt_stub) - 1)) == NULL) {
26392640
if (closeoldfile) {
26402641
php_stream_close(oldfile);
@@ -3513,8 +3514,6 @@ void phar_request_initialize(void) /* {{{ */
35133514

35143515
PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
35153516
{
3516-
uint32_t i;
3517-
35183517
PHAR_G(request_ends) = 1;
35193518

35203519
if (PHAR_G(request_init))
@@ -3529,7 +3528,7 @@ PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
35293528
PHAR_G(phar_SERVER_mung_list) = 0;
35303529

35313530
if (PHAR_G(cached_fp)) {
3532-
for (i = 0; i < zend_hash_num_elements(&cached_phars); ++i) {
3531+
for (uint32_t i = 0; i < zend_hash_num_elements(&cached_phars); ++i) {
35333532
if (PHAR_G(cached_fp)[i].fp) {
35343533
php_stream_close(PHAR_G(cached_fp)[i].fp);
35353534
}

0 commit comments

Comments
 (0)