diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index c19873cf3be3..2e6ddd2f4d8b 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -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)) { @@ -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 diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index 86c3a49f8c8c..7fe1b8bbdf1d 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -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 - @@ -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;