Skip to content

Commit e122152

Browse files
committed
Simplify (bitset & flag) == flag conditions
Closes GH-16558
1 parent e00079d commit e122152

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Zend/zend_execute.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal
505505
} \
506506
} while (0)
507507

508-
#define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) == ZEND_ACC_HAS_TYPE_HINTS)
509-
#define ZEND_CLASS_HAS_READONLY_PROPS(ce) ((ce->ce_flags & ZEND_ACC_HAS_READONLY_PROPS) == ZEND_ACC_HAS_READONLY_PROPS)
508+
#define ZEND_CLASS_HAS_TYPE_HINTS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS))
509+
#define ZEND_CLASS_HAS_READONLY_PROPS(ce) ((bool)(ce->ce_flags & ZEND_ACC_HAS_READONLY_PROPS))
510510

511511

512512
ZEND_API bool zend_verify_class_constant_type(zend_class_constant *c, const zend_string *name, zval *constant);

Zend/zend_inheritance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
22812281
* of where it is coming from there is no conflict and we do not need to add it again */
22822282
if (existing_fn->op_array.opcodes == fn->op_array.opcodes &&
22832283
(existing_fn->common.fn_flags & ZEND_ACC_PPP_MASK) == (fn->common.fn_flags & ZEND_ACC_PPP_MASK) &&
2284-
(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
2284+
(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) {
22852285
return;
22862286
}
22872287

@@ -2347,7 +2347,7 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
23472347

23482348
static void zend_fixup_trait_method(zend_function *fn, zend_class_entry *ce) /* {{{ */
23492349
{
2350-
if ((fn->common.scope->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
2350+
if (fn->common.scope->ce_flags & ZEND_ACC_TRAIT) {
23512351

23522352
fn->common.scope = ce;
23532353

ext/standard/string.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,11 +1600,11 @@ PHP_FUNCTION(pathinfo)
16001600
Z_PARAM_LONG(opt)
16011601
ZEND_PARSE_PARAMETERS_END();
16021602

1603-
have_basename = ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME);
1603+
have_basename = (opt & PHP_PATHINFO_BASENAME);
16041604

16051605
array_init(&tmp);
16061606

1607-
if ((opt & PHP_PATHINFO_DIRNAME) == PHP_PATHINFO_DIRNAME) {
1607+
if (opt & PHP_PATHINFO_DIRNAME) {
16081608
dirname = estrndup(path, path_len);
16091609
php_dirname(dirname, path_len);
16101610
if (*dirname) {
@@ -1618,7 +1618,7 @@ PHP_FUNCTION(pathinfo)
16181618
add_assoc_str(&tmp, "basename", zend_string_copy(ret));
16191619
}
16201620

1621-
if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) {
1621+
if (opt & PHP_PATHINFO_EXTENSION) {
16221622
const char *p;
16231623
ptrdiff_t idx;
16241624

@@ -1634,7 +1634,7 @@ PHP_FUNCTION(pathinfo)
16341634
}
16351635
}
16361636

1637-
if ((opt & PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) {
1637+
if (opt & PHP_PATHINFO_FILENAME) {
16381638
const char *p;
16391639
ptrdiff_t idx;
16401640

0 commit comments

Comments
 (0)