1
0
mirror of https://github.com/php/php-src.git synced 2026-04-06 23:53:30 +02:00

Allow zend_is_interned_string to be pluggable

This commit is contained in:
Gopal Vijayaraghavan
2011-07-27 23:34:49 +00:00
parent 15383e046e
commit be217d08a4
2 changed files with 10 additions and 1 deletions

View File

@@ -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 @@ void zend_interned_strings_init(TSRMLS_D)
#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 @@ static const char *zend_new_interned_string_int(const char *arKey, int nKeyLengt
#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);

View File

@@ -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 @@ void zend_interned_strings_dtor(TSRMLS_D);
#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