}
-ZEND_API inline int array_init(zval *arg)
+ZEND_API inline int _array_init(zval *arg ZEND_FILE_LINE_DC)
{
- ALLOC_HASHTABLE(arg->value.ht);
+ ALLOC_HASHTABLE_REL(arg->value.ht);
if (!arg->value.ht || zend_hash_init(arg->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0)) {
zend_error(E_CORE_ERROR, "Cannot allocate memory for array");
}
-ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
+ZEND_API inline int _object_init_ex(zval *arg, zend_class_entry *class_type ZEND_FILE_LINE_DC)
{
zval *tmp;
class_type->constants_updated = 1;
}
- ALLOC_HASHTABLE(arg->value.obj.properties);
+ ALLOC_HASHTABLE_REL(arg->value.obj.properties);
zend_hash_init(arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
arg->type = IS_OBJECT;
}
-ZEND_API inline int object_init(zval *arg)
+ZEND_API inline int _object_init(zval *arg ZEND_FILE_LINE_DC)
{
- return object_init_ex(arg, &zend_standard_class_def);
+ return _object_init_ex(arg, &zend_standard_class_def ZEND_FILE_LINE_CC);
}
ZEND_API int zend_startup_module(zend_module_entry *module);
-ZEND_API int array_init(zval *arg);
-ZEND_API int object_init(zval *arg);
-ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce);
+#define array_init(arg) _array_init((arg) ZEND_FILE_LINE_CC)
+#define object_init(arg) _object_init((arg) ZEND_FILE_LINE_CC)
+#define object_init_ex(arg, ce) _object_init_ex((arg), (ce) ZEND_FILE_LINE_CC)
+ZEND_API int _array_init(zval *arg ZEND_FILE_LINE_DC);
+ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC);
+ZEND_API int _object_init_ex(zval *arg, zend_class_entry *ce ZEND_FILE_LINE_DC);
/* no longer supported */
ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
AG(fast_cache_list_head)[fc_type] = (zend_fast_cache_list_entry *) (p); \
}
+#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
+ ZEND_FAST_ALLOC(p, type, fc_type)
+
+#define ZEND_FAST_FREE_REL(p, fc_type) \
+ ZEND_FAST_FREE(p, fc_type)
+
#else /* !ZEND_ENABLE_FAST_CACHE */
#define ZEND_FAST_FREE(p, fc_type) \
efree(p)
+#define ZEND_FAST_ALLOC_REL(p, type, fc_type) \
+ (p) = (type *) emalloc_rel(sizeof(type))
+
+#define ZEND_FAST_FREE_REL(p, fc_type) \
+ efree_rel(p)
+
#endif /* ZEND_ENABLE_FAST_CACHE */
#define FREE_ZVAL(z) \
ZEND_FAST_FREE(z, ZVAL_CACHE_LIST)
+#define ALLOC_ZVAL_REL(z) \
+ ZEND_FAST_ALLOC_REL(z, zval, ZVAL_CACHE_LIST)
+
+#define FREE_ZVAL_REL(z) \
+ ZEND_FAST_FREE_REL(z, ZVAL_CACHE_LIST)
+
/* fast cache for HashTable's */
-#define ALLOC_HASHTABLE(b) \
- ZEND_FAST_ALLOC(b, HashTable, HASHTABLE_CACHE_LIST)
+#define ALLOC_HASHTABLE(ht) \
+ ZEND_FAST_ALLOC(ht, HashTable, HASHTABLE_CACHE_LIST)
#define FREE_HASHTABLE(ht) \
ZEND_FAST_FREE(ht, HASHTABLE_CACHE_LIST)
+#define ALLOC_HASHTABLE_REL(ht) \
+ ZEND_FAST_ALLOC_REL(ht, HashTable, HASHTABLE_CACHE_LIST)
+
+#define FREE_HASHTABLE_REL(ht) \
+ ZEND_FAST_FREE_REL(ht, HASHTABLE_CACHE_LIST)
+
#endif /* _ZEND_FAST_CACHE_H */
/*
#define HT_OK 0
static void _zend_is_inconsistent(HashTable *ht, char *file, int line)
-{
+{
switch (ht->inconsistent) {
case HT_IS_DESTROYING:
zend_error(E_CORE_ERROR, "ht=%08x is destroying in %s:%d", ht, file, line);
#define UPDATE_DATA(ht, p, pData, nDataSize) \
if (flag & HASH_ADD_PTR) { \
if (!(p)->pDataPtr) { \
- pefree(p, (ht)->persistent); \
+ pefree((p)->pData, (ht)->persistent); \
} \
(p)->pDataPtr = pData; \
(p)->pData = &(p)->pDataPtr; \