Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Zend/zend_objects_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_sto
{
EG(flags) |= EG_FLAGS_OBJECT_STORE_NO_REUSE;
if (objects->top > 1) {
uint32_t i;
for (i = 1; i < objects->top; i++) {
for (uint32_t i = 1; i < objects->top; i++) {
zend_object *obj = objects->object_buckets[i];
if (IS_OBJ_VALID(obj)) {
if (!(OBJ_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) {
Expand Down Expand Up @@ -128,20 +127,19 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_
/* Store objects API */
static ZEND_COLD zend_never_inline void ZEND_FASTCALL zend_objects_store_put_cold(zend_object *object)
{
int handle;
uint32_t new_size = 2 * EG(objects_store).size;

EG(objects_store).object_buckets = (zend_object **) erealloc(EG(objects_store).object_buckets, new_size * sizeof(zend_object*));
/* Assign size after realloc, in case it fails */
EG(objects_store).size = new_size;
handle = EG(objects_store).top++;
uint32_t handle = EG(objects_store).top++;
object->handle = handle;
EG(objects_store).object_buckets[handle] = object;
}

ZEND_API void ZEND_FASTCALL zend_objects_store_put(zend_object *object)
{
int handle;
uint32_t handle;

/* When in shutdown sequence - do not reuse previously freed handles, to make sure
* the dtors for newly created objects are called in zend_objects_store_call_destructors() loop
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_objects_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static zend_always_inline void zend_object_release(zend_object *obj)
}
}

static zend_always_inline size_t zend_object_properties_size(zend_class_entry *ce)
static zend_always_inline size_t zend_object_properties_size(const zend_class_entry *ce)
{
return sizeof(zval) *
(ce->default_properties_count -
Expand All @@ -90,7 +90,7 @@ static zend_always_inline size_t zend_object_properties_size(zend_class_entry *c
/* Allocates object type and zeros it, but not the standard zend_object and properties.
* Standard object MUST be initialized using zend_object_std_init().
* Properties MUST be initialized using object_properties_init(). */
static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) {
static zend_always_inline void *zend_object_alloc(size_t obj_size, const zend_class_entry *ce) {
void *obj = emalloc(obj_size + zend_object_properties_size(ce));
memset(obj, 0, obj_size - sizeof(zend_object));
return obj;
Expand Down
Loading