From dd5c478be61a0ef94b54837cfa875c964356e14f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 20 Apr 2010 11:05:54 +0000 Subject: Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed. --- Zend/zend.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zend/zend.h') diff --git a/Zend/zend.h b/Zend/zend.h index fce65e0337..6348e5997c 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -237,6 +237,7 @@ char *alloca (); #include "zend_alloc.h" #include "zend_types.h" +#include "zend_string.h" #ifdef HAVE_LIMITS_H # include @@ -599,8 +600,8 @@ END_EXTERN_C() /* FIXME: Check if we can save if (ptr) too */ -#define STR_FREE(ptr) if (ptr) { efree(ptr); } -#define STR_FREE_REL(ptr) if (ptr) { efree_rel(ptr); } +#define STR_FREE(ptr) if (ptr && !IS_INTERNED(ptr)) { efree(ptr); } +#define STR_FREE_REL(ptr) if (ptr && !IS_INTERNED(ptr)) { efree_rel(ptr); } #define STR_EMPTY_ALLOC() estrndup("", sizeof("")-1) -- cgit v1.2.1