]> granicus.if.org Git - php/commitdiff
- Enable the new zval cache on debug too. No real reason not to, and it keeps
authorZeev Suraski <zeev@php.net>
Sun, 26 Dec 1999 23:20:18 +0000 (23:20 +0000)
committerZeev Suraski <zeev@php.net>
Sun, 26 Dec 1999 23:20:18 +0000 (23:20 +0000)
  the code cleaner.
- ZTS compile fixes

Zend/Zend.dsp
Zend/ZendTS.dsp
Zend/zend_alloc.c
Zend/zend_globals.h
Zend/zend_zval_alloc.h

index 90fe19498d0ef506d398497cf18b38512ac47a52..e30c62f75f1d53ac6f027d28e5e2f93fda4f9188 100644 (file)
@@ -268,6 +268,10 @@ SOURCE=.\zend_stack.h
 \r
 SOURCE=.\zend_variables.h\r
 # End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\zend_zval_alloc.h\r
+# End Source File\r
 # End Group\r
 # Begin Group "Parsers"\r
 \r
index b773d76ce82eb4295da10fa2dce364cabb30a837..6fcb29d9b6cd3be42ecdb642d8f0d337cb4480b3 100644 (file)
@@ -272,6 +272,10 @@ SOURCE=.\zend_stack.h
 \r
 SOURCE=.\zend_variables.h\r
 # End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\zend_zval_alloc.h\r
+# End Source File\r
 # End Group\r
 # Begin Group "Parsers"\r
 \r
index b100526e964f2fce1b8c48a685c488c63d171b21..55a2dec123fcbb3b318d6eab07a4613d8691caaf 100644 (file)
@@ -315,6 +315,7 @@ ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
 ZEND_API void start_memory_manager(ALS_D)
 {
        AG(phead) = AG(head) = NULL;
+       AG(zval_list_head) = NULL;
        
 #if MEMORY_LIMIT
        AG(memory_limit)=1<<30;         /* rediculous limit, effectively no limit */
@@ -322,9 +323,6 @@ ZEND_API void start_memory_manager(ALS_D)
        AG(memory_exhausted)=0;
 #endif
 
-#if !ZEND_DEBUG
-       AG(zval_list_head) = NULL;
-#endif
 
        memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char));
 }
@@ -335,12 +333,10 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
        zend_mem_header *p, *t;
 #if ZEND_DEBUG
        int had_leaks=0;
-#else
-       zend_zval_list_entry *zval_list_entry, *next_zval_list_entry;
 #endif
+       zend_zval_list_entry *zval_list_entry, *next_zval_list_entry;
        ALS_FETCH();
 
-#if !ZEND_DEBUG
        zval_list_entry = AG(zval_list_head);
        while (zval_list_entry) {
                next_zval_list_entry = zval_list_entry->next;
@@ -348,7 +344,6 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
                zval_list_entry = next_zval_list_entry;
        }
        AG(zval_list_head) = NULL;
-#endif
 
        p=AG(head);
        t=AG(head);
index 5a08c11a825870514ee30dc275709556449c20b4..b03bca1d153b3a2a5d11b3d9e90c4a02ddda8834 100644 (file)
@@ -179,9 +179,7 @@ struct _zend_alloc_globals {
        zend_mem_header *phead;         /* persistent list */
        void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
        unsigned char cache_count[MAX_CACHED_MEMORY];
-#if !ZEND_DEBUG
        void *zval_list_head;
-#endif
 
 #if MEMORY_LIMIT
        unsigned int memory_limit;
index 1f469f4a6ba19b070661bde36f6b20b80c43cbf6..38677ce76db5362ddddc90aa5ade28c632ad7f76 100644 (file)
 #include "zend_globals_macros.h"
 #include "zend_alloc.h"
 
-#if ZEND_DEBUG
-
-# define ALLOC_ZVAL(z) (z) = emalloc(sizeof(zval))
-# define FREE_ZVAL(z)  efree(z)
-
-#else /* !ZEND_DEBUG */
-
-extern zend_alloc_globals alloc_globals;
-
 typedef struct _zend_zval_list_entry {
        struct _zend_zval_list_entry *next;
 } zend_zval_list_entry;
 
 
+#ifndef ZTS
+extern zend_alloc_globals alloc_globals;
+#endif
+
 #define ALLOC_ZVAL(z)                                                                  \
        {                                                                                                       \
                ALS_FETCH();                                                                    \
@@ -51,15 +46,15 @@ typedef struct _zend_zval_list_entry {
        }
 
 
-#define FREE_ZVAL(z)                                                                                   \
-       {                                                                                                                       \
+#define FREE_ZVAL(z)                                                                                           \
+       {                                                                                                                               \
+               ALS_FETCH();                                                                                            \
+                                                                                                                                       \
                ((zend_zval_list_entry *) (z))->next = AG(zval_list_head);      \
                AG(zval_list_head) = (zend_zval_list_entry *) (z);                      \
        }
 
 
-#endif /* !ZEND_DEBUG */
-
 #endif
 
 /*