com php-src: Fix ast size computation in case of zero children: Zend/zend_ast.c
| From: | Nikita Popov | Date: | Tue, 19 Aug 2014 09:38:09 +0000 |
| Subject: | com php-src: Fix ast size computation in case of zero children: Zend/zend_ast.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80889@lists.php.net to get a copy of this message | ||
Commit: 69f0deb399eec76bc8afa97fa383b08a207582fb
Author: Nikita Popov <nikic@php.net> Tue, 19 Aug 2014 11:38:09 +0200
Parents: ce9971231598f6a51a028ab8222063efdf403255
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=69f0deb399eec76bc8afa97fa383b08a207582fb
Log:
Fix ast size computation in case of zero children
Changed paths:
M Zend/zend_ast.c
Diff:
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index eb35a51..822698a 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -34,11 +34,11 @@ static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size
}
size_t zend_ast_size(zend_uint children) {
- return sizeof(zend_ast) + sizeof(zend_ast *) * (children - 1);
+ return sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
}
size_t zend_ast_list_size(zend_uint children) {
- return sizeof(zend_ast_list) + sizeof(zend_ast *) * (children - 1);
+ return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
}
ZEND_API zend_ast *zend_ast_create_znode(znode *node) {