com php-src: newly added zend_object_store.no_reuse i s redefined as a global zend_object_store_no_ reuse, to avoid alignment issues: Zend/zend_obj ects_API.c Zend/zend_objects_API.h

[email protected] (Dmitry Stogov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    f9afc6aabc8af2da5874b32e11f9e4cca722c079
Author:    Jim Zubov <[email protected]>         Tue, 7 Feb 2017 21:13:39 -0500
Parents:   a6acffe421c1ea5e0d654169a17103285711596e
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=f9afc6aabc8af2da5874b32e11f9e4cca722c079

Log:
newly added zend_object_store.no_reuse is redefined as a global zend_object_store_no_reuse,
to avoid alignment issues

Changed paths:
  M  Zend/zend_objects_API.c
  M  Zend/zend_objects_API.h


Diff:
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index a0de331..b64d413 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -26,13 +26,15 @@
 #include "zend_API.h"
 #include "zend_objects_API.h"
 
+ZEND_TLS zend_objects_store_no_reuse; /* Would make more sense to make it a member of zend_objects_store, defining as a global to not break alignments */
+
 ZEND_API void zend_objects_store_init(zend_objects_store *objects, uint32_t init_size)
 {
 	objects->object_buckets = (zend_object **) emalloc(init_size * sizeof(zend_object*));
 	objects->top = 1; /* Skip 0 so that handles are true */
 	objects->size = init_size;
 	objects->free_list_head = -1;
-	objects->no_reuse = 0;
+	zend_objects_store_no_reuse = 0;
 	memset(&objects->object_buckets[0], 0, sizeof(zend_object*));
 }
 
@@ -44,7 +46,7 @@ ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
 
 ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects)
 {
-	objects->no_reuse = 1; /* new objects spawned by dtors will never reuse unused slots, so their own dtors will be called further down the loop */
+	zend_objects_store_no_reuse = 1; /* new objects spawned by dtors will never reuse unused slots, so their own dtors will be called further down the loop */
 	if (objects->top > 1) {
 		uint32_t i;
 		for (i = 1; i < objects->top; i++) {
@@ -113,7 +115,7 @@ ZEND_API void zend_objects_store_put(zend_object *object)
 {
 	int handle;
 
-	if (!EG(objects_store).no_reuse && EG(objects_store).free_list_head != -1) {
+	if (!zend_objects_store_no_reuse && EG(objects_store).free_list_head != -1) {
 		handle = EG(objects_store).free_list_head;
 		EG(objects_store).free_list_head = GET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle]);
 	} else {
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index 08b0a13..2230600 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -45,7 +45,6 @@ typedef struct _zend_objects_store {
 	uint32_t top;
 	uint32_t size;
 	int free_list_head;
-	int no_reuse; /* to be set to true when shutting down, to avoid missing dtor call on objects spawned by another dtor */
 } zend_objects_store;
 
 /* Global store handling functions */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.