Just in case people are wondering what this is about, this is to make interned strings play nice with opcode caches or any other extension that might need to play at that level.
Gopal, could you commit this to trunk as well please? -Rasmus On 07/27/2011 04:34 PM, Gopal Vijayaraghavan wrote: > gopalv Wed, 27 Jul 2011 23:34:49 +0000 > > Revision: http://svn.php.net/viewvc?view=revision&revision=313803 > > Log: > Allow zend_is_interned_string to be pluggable > > Changed paths: > U php/php-src/branches/PHP_5_4/Zend/zend_string.c > U php/php-src/branches/PHP_5_4/Zend/zend_string.h > > Modified: php/php-src/branches/PHP_5_4/Zend/zend_string.c > =================================================================== > --- php/php-src/branches/PHP_5_4/Zend/zend_string.c 2011-07-27 23:06:09 UTC > (rev 313802) > +++ php/php-src/branches/PHP_5_4/Zend/zend_string.c 2011-07-27 23:34:49 UTC > (rev 313803) > @@ -30,10 +30,12 @@ > #endif > > ZEND_API const char *(*zend_new_interned_string)(const char *str, int len, > int free_src TSRMLS_DC); > +ZEND_API zend_bool (*zend_is_interned_string)(const char *str TSRMLS_DC); > ZEND_API void (*zend_interned_strings_snapshot)(TSRMLS_D); > ZEND_API void (*zend_interned_strings_restore)(TSRMLS_D); > > static const char *zend_new_interned_string_int(const char *str, int len, > int free_src TSRMLS_DC); > +static zend_bool zend_is_interned_string_int(const char *str TSRMLS_DC); > static void zend_interned_strings_snapshot_int(TSRMLS_D); > static void zend_interned_strings_restore_int(TSRMLS_D); > > @@ -64,6 +66,7 @@ > #endif > > zend_new_interned_string = zend_new_interned_string_int; > + zend_is_interned_string = zend_is_interned_string_int; > zend_interned_strings_snapshot = zend_interned_strings_snapshot_int; > zend_interned_strings_restore = zend_interned_strings_restore_int; > } > @@ -177,6 +180,11 @@ > #endif > } > > +static zend_bool zend_is_interned_string_int(const char *s TSRMLS_DC) > +{ > + return (((s) >= CG(interned_strings_start)) && ((s) < > CG(interned_strings_end))); > +} > + > static void zend_interned_strings_snapshot_int(TSRMLS_D) > { > CG(interned_strings_snapshot_top) = CG(interned_strings_top); > > Modified: php/php-src/branches/PHP_5_4/Zend/zend_string.h > =================================================================== > --- php/php-src/branches/PHP_5_4/Zend/zend_string.h 2011-07-27 23:06:09 UTC > (rev 313802) > +++ php/php-src/branches/PHP_5_4/Zend/zend_string.h 2011-07-27 23:34:49 UTC > (rev 313803) > @@ -24,6 +24,7 @@ > #include "zend.h" > > ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int > len, int free_src TSRMLS_DC); > +ZEND_API extern zend_bool (*zend_is_interned_string)(const char *str > TSRMLS_DC); > ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); > ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); > > @@ -33,7 +34,7 @@ > #ifndef ZTS > > #define IS_INTERNED(s) \ > - (((s) >= CG(interned_strings_start)) && ((s) < > CG(interned_strings_end))) > + (zend_is_interned_string ? zend_is_interned_string((s) TSRMLS_CC) : 0) > > #else > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php