}
+#ifdef ZTS
static void copy_zend_constant(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
- Z_PTR_P(zv) = pemalloc(sizeof(zend_constant), c->flags & CONST_PERSISTENT);
+ ZEND_ASSERT(c->flags & CONST_PERSISTENT);
+ Z_PTR_P(zv) = pemalloc(sizeof(zend_constant), 1);
memcpy(Z_PTR_P(zv), c, sizeof(zend_constant));
c = Z_PTR_P(zv);
c->name = zend_string_copy(c->name);
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_copy_ctor(&c->value);
- } else {
- if (Z_TYPE(c->value) == IS_STRING) {
- Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1);
- }
+ if (Z_TYPE(c->value) == IS_STRING) {
+ Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1);
}
}
{
zend_hash_copy(target, source, copy_zend_constant);
}
+#endif
static int clean_module_constant(zval *el, void *arg)
ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number);
ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number);
ZEND_API int zend_register_constant(zend_constant *c);
+#ifdef ZTS
void zend_copy_constants(HashTable *target, HashTable *sourc);
+#endif
ZEND_API zend_constant* ZEND_FASTCALL zend_quick_get_constant(const zval *key, uint32_t flags);
END_EXTERN_C()