Skip to content

Commit b476591

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

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ext/bz2/bz2_filter.c

+9-7
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,15 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
335335

336336
if (filterparams) {
337337
zval *tmpzval = NULL;
338+
const HashTable *filter_params_ht = HASH_OF(filterparams);
338339

339-
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+
if (filter_params_ht != NULL) {
341+
if ((tmpzval = zend_hash_str_find(filter_params_ht, ZEND_STRL("concatenated")))) {
341342
data->expect_concatenated = zend_is_true(tmpzval);
342343
tmpzval = NULL;
343344
}
344345

345-
tmpzval = zend_hash_str_find(HASH_OF(filterparams), "small", sizeof("small")-1);
346+
tmpzval = zend_hash_str_find(filter_params_ht, ZEND_STRL("small"));
346347
} else {
347348
tmpzval = filterparams;
348349
}
@@ -359,10 +360,11 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
359360
int workFactor = PHP_BZ2_FILTER_DEFAULT_WORKFACTOR;
360361

361362
if (filterparams) {
362-
zval *tmpzval;
363+
const HashTable *filter_params_ht = HASH_OF(filterparams);
363364

364-
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))) {
365+
if (filter_params_ht != NULL) {
366+
zval *tmpzval;
367+
if ((tmpzval = zend_hash_str_find(filter_params_ht, ZEND_STRL("blocks")))) {
366368
/* How much memory to allocate (1 - 9) x 100kb */
367369
zend_long blocks = zval_get_long(tmpzval);
368370
if (blocks < 1 || blocks > 9) {
@@ -372,7 +374,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
372374
}
373375
}
374376

375-
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "work", sizeof("work")-1))) {
377+
if ((tmpzval = zend_hash_str_find(filter_params_ht, ZEND_STRL("work")))) {
376378
/* Work Factor (0 - 250) */
377379
zend_long work = zval_get_long(tmpzval);
378380
if (work < 0 || work > 250) {

0 commit comments

Comments
 (0)