Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ typedef void (*zend_ast_apply_func)(zend_ast **ast_ptr, void *context);
ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *context);

static zend_always_inline size_t zend_ast_size(uint32_t children) {
return sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
return XtOffsetOf(zend_ast, child) + (sizeof(zend_ast *) * children);
}

static zend_always_inline bool zend_ast_is_special(zend_ast *ast) {
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static zend_ast *zend_persist_ast(zend_ast *ast)
node = (zend_ast *) copy;
} else {
uint32_t children = zend_ast_get_num_children(ast);
node = zend_shared_memdup(ast, sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
node = zend_shared_memdup(ast, zend_ast_size(children));
for (i = 0; i < children; i++) {
if (node->child[i]) {
node->child[i] = zend_persist_ast(node->child[i]);
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_persist_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void zend_persist_ast_calc(zend_ast *ast)
}
} else {
uint32_t children = zend_ast_get_num_children(ast);
ADD_SIZE(sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
ADD_SIZE(zend_ast_size(children));
for (i = 0; i < children; i++) {
if (ast->child[i]) {
zend_persist_ast_calc(ast->child[i]);
Expand Down