Skip to content

Commit 7f1cc0e

Browse files
committed
spl: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle: @r1@ identifier F; identifier p; typedef bool; parameter list [n1] PL1; parameter list [n2] PL2; @@ F(PL1, bool p, PL2) { ... } @r2@ identifier r1.F; expression list [r1.n1] EL1; expression list [r1.n2] EL2; @@ F(EL1, ( - 1 + true | - 0 + false ) , EL2)
1 parent 9659d7f commit 7f1cc0e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ext/spl/spl_array.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ static zval *spl_array_get_property_ptr_ptr(zend_object *object, zend_string *na
875875
return NULL;
876876
}
877877
ZVAL_STR(&member, name);
878-
return spl_array_get_dimension_ptr(1, intern, object->ce->name, &member, type);
878+
return spl_array_get_dimension_ptr(true, intern, object->ce->name, &member, type);
879879
}
880880
return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
881881
} /* }}} */
@@ -1140,7 +1140,7 @@ PHP_METHOD(ArrayObject, exchangeArray)
11401140
}
11411141

11421142
RETVAL_ARR(zend_array_dup(spl_array_get_hash_table(intern)));
1143-
spl_array_set_array(object, intern, array, 0L, 1);
1143+
spl_array_set_array(object, intern, array, 0L, true);
11441144
}
11451145
/* }}} */
11461146

@@ -1413,7 +1413,7 @@ PHP_METHOD(ArrayObject, unserialize)
14131413
ZVAL_NULL(array);
14141414
SEPARATE_ARRAY(&intern->array);
14151415
} else {
1416-
spl_array_set_array(object, intern, array, 0L, 1);
1416+
spl_array_set_array(object, intern, array, 0L, true);
14171417
}
14181418

14191419
if (*p != ';') {
@@ -1526,7 +1526,7 @@ PHP_METHOD(ArrayObject, __unserialize)
15261526
zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object", 0);
15271527
RETURN_THROWS();
15281528
}
1529-
spl_array_set_array(ZEND_THIS, intern, storage_zv, 0L, 1);
1529+
spl_array_set_array(ZEND_THIS, intern, storage_zv, 0L, true);
15301530
}
15311531

15321532
object_properties_load(&intern->std, Z_ARRVAL_P(members_zv));

ext/spl/spl_fixedarray.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
303303

304304
static zend_object *spl_fixedarray_new(zend_class_entry *class_type)
305305
{
306-
return spl_fixedarray_object_new_ex(class_type, NULL, 0);
306+
return spl_fixedarray_object_new_ex(class_type, NULL, false);
307307
}
308308

309309
static zend_object *spl_fixedarray_object_clone(zend_object *old_object)
310310
{
311-
zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, 1);
311+
zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, true);
312312

313313
zend_objects_clone_members(new_object, old_object);
314314

@@ -815,7 +815,7 @@ PHP_METHOD(SplFixedArray, offsetExists)
815815

816816
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
817817

818-
RETURN_BOOL(spl_fixedarray_object_has_dimension_helper(intern, zindex, 0));
818+
RETURN_BOOL(spl_fixedarray_object_has_dimension_helper(intern, zindex, false));
819819
}
820820

821821
/* Returns the value at the specified $index. */

0 commit comments

Comments
 (0)