Skip to content

Commit b699e22

Browse files
committed
ext/bz2: Fix nonnull warnings
1 parent 4f77528 commit b699e22

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/bz2/bz2_filter.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,15 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
337337
zval *tmpzval = NULL;
338338

339339
if (Z_TYPE_P(filterparams) == IS_ARRAY || Z_TYPE_P(filterparams) == IS_OBJECT) {
340-
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "concatenated", sizeof("concatenated")-1))) {
340+
HashTable *filter_params_ht = HASH_OF(filterparams);
341+
ZEND_ASSERT(filter_params_ht != NULL);
342+
343+
if ((tmpzval = zend_hash_str_find(filter_params_ht, "concatenated", sizeof("concatenated")-1))) {
341344
data->expect_concatenated = zend_is_true(tmpzval);
342345
tmpzval = NULL;
343346
}
344347

345-
tmpzval = zend_hash_str_find(HASH_OF(filterparams), "small", sizeof("small")-1);
348+
tmpzval = zend_hash_str_find(filter_params_ht, "small", sizeof("small")-1);
346349
} else {
347350
tmpzval = filterparams;
348351
}
@@ -362,7 +365,10 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
362365
zval *tmpzval;
363366

364367
if (Z_TYPE_P(filterparams) == IS_ARRAY || Z_TYPE_P(filterparams) == IS_OBJECT) {
365-
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "blocks", sizeof("blocks")-1))) {
368+
HashTable *filter_params_ht = HASH_OF(filterparams);
369+
ZEND_ASSERT(filter_params_ht != NULL);
370+
371+
if ((tmpzval = zend_hash_str_find(filter_params_ht, "blocks", sizeof("blocks")-1))) {
366372
/* How much memory to allocate (1 - 9) x 100kb */
367373
zend_long blocks = zval_get_long(tmpzval);
368374
if (blocks < 1 || blocks > 9) {
@@ -372,7 +378,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
372378
}
373379
}
374380

375-
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "work", sizeof("work")-1))) {
381+
if ((tmpzval = zend_hash_str_find(filter_params_ht, "work", sizeof("work")-1))) {
376382
/* Work Factor (0 - 250) */
377383
zend_long work = zval_get_long(tmpzval);
378384
if (work < 0 || work > 250) {

0 commit comments

Comments
 (0)