return zend_mm_alloc_huge(AG(mm_heap), size);
}
+#if ZEND_DEBUG
# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
TSRMLS_FETCH(); \
zend_mm_free_small(AG(mm_heap), ptr, _num); \
} \
}
+#else
+# define _ZEND_BIN_FREE(_num, _size, _elements, _pages, x, y) \
+ ZEND_API void ZEND_FASTCALL _efree_ ## _size(void *ptr) { \
+ TSRMLS_FETCH(); \
+ ZEND_MM_CUSTOM_DEALLOCATOR(ptr); \
+ { \
+ zend_mm_chunk *chunk = (zend_mm_chunk*)ZEND_MM_ALIGNED_BASE(ptr, ZEND_MM_CHUNK_SIZE); \
+ ZEND_MM_CHECK(chunk->heap == AG(mm_heap), "zend_mm_heap corrupted"); \
+ zend_mm_free_small(AG(mm_heap), ptr, _num); \
+ } \
+ }
+#endif
ZEND_MM_BINS_INFO(_ZEND_BIN_FREE, x, y)
static zend_op *zend_delayed_compile_end(uint32_t offset TSRMLS_DC) /* {{{ */
{
- zend_op *opline, *oplines = zend_stack_base(&CG(delayed_oplines_stack));
+ zend_op *opline = NULL, *oplines = zend_stack_base(&CG(delayed_oplines_stack));
uint32_t i, count = zend_stack_count(&CG(delayed_oplines_stack));
ZEND_ASSERT(count > offset);
{
zend_ast_list *list = zend_ast_get_list(ast);
uint32_t i;
- uint32_t *jmp_opnums;
+ uint32_t *jmp_opnums = NULL;
if (list->children > 1) {
jmp_opnums = safe_emalloc(sizeof(uint32_t), list->children - 1, 0);
void zend_compile_magic_const(znode *result, zend_ast *ast TSRMLS_DC) /* {{{ */
{
- zend_class_entry *ce = CG(active_class_entry);
-
if (zend_try_ct_eval_magic_const(&result->u.constant, ast TSRMLS_CC)) {
result->op_type = IS_CONST;
return;
}
- ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce));
+ ZEND_ASSERT(ast->attr == T_CLASS_C &&
+ CG(active_class_entry) &&
+ ZEND_CE_IS_TRAIT(CG(active_class_entry)));
{
zend_ast *const_ast = zend_ast_create(ZEND_AST_CONST,
void zend_compile_const_expr_magic_const(zend_ast **ast_ptr TSRMLS_DC) /* {{{ */
{
zend_ast *ast = *ast_ptr;
- zend_class_entry *ce = CG(active_class_entry);
/* Other cases already resolved by constant folding */
- ZEND_ASSERT(ast->attr == T_CLASS_C && ce && ZEND_CE_IS_TRAIT(ce));
+ ZEND_ASSERT(ast->attr == T_CLASS_C &&
+ CG(active_class_entry) &&
+ ZEND_CE_IS_TRAIT(CG(active_class_entry)));
{
zval const_zv;
fclass = "";
}
- if (arg && zf->common.type == ZEND_USER_FUNCTION) {
- ZVAL_COPY_VALUE(&old_arg, arg);
- ZVAL_UNDEF(arg);
- }
+ if (zf->common.type == ZEND_USER_FUNCTION) {
+ if (arg) {
+ ZVAL_COPY_VALUE(&old_arg, arg);
+ ZVAL_UNDEF(arg);
+ }
- if (zf->common.type == ZEND_USER_FUNCTION && ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
- zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->func->op_array.filename->val, ptr->opline->lineno);
+ if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
+ zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->func->op_array.filename->val, ptr->opline->lineno);
+ } else {
+ zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
+ }
+
+ if (arg) {
+ ZVAL_COPY_VALUE(arg, &old_arg);
+ }
} else {
zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
}
-
- if (arg && zf->common.type == ZEND_USER_FUNCTION) {
- ZVAL_COPY_VALUE(arg, &old_arg);
- }
}
static int is_null_constant(zval *default_value TSRMLS_DC)
static void gc_remove_nested_data_from_buffer(zend_refcounted *ref TSRMLS_DC)
{
- HashTable *ht;
+ HashTable *ht = NULL;
uint idx;
Bucket *p;
#define zendleng LANG_SCNG(yy_leng)
-static void handle_whitespace(int *emit_whitespace)
+static void handle_whitespace(unsigned int *emit_whitespace)
{
unsigned char c;
int i;