Guest User

Untitled

a guest
Apr 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include "zend_ast.h"
  2. #include "zend_API.h"
  3. #include "zend_operators.h"
  4. #include "zend_language_parser.h"
  5. #include "zend_smart_str.h"
  6. #include "zend_exceptions.h"
  7. #include "zend_constants.h"
  8.  
  9. ZEND_API zend_ast_process_t zend_ast_process = NULL;
  10.  
  11. static inline void *zend_ast_alloc(size_t size) {
  12. return zend_arena_alloc(&CG(ast_arena), size);
  13. }
  14.  
  15. static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size) {
  16. void *new = zend_ast_alloc(new_size);
  17. memcpy(new, old, old_size);
  18. return new;
  19. }
  20.  
  21. static inline size_t zend_ast_size(uint32_t children) {
  22. return sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
  23. }
  24.  
  25. static inline size_t zend_ast_list_size(uint32_t children) {
  26. return sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * children;
  27. }
  28. // Errors start here from this asterisk.
  29. ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_znode(znode *node) {
  30. zend_ast_znode *ast;
  31.  
  32. ast = zend_ast_alloc(sizeof(zend_ast_znode));
  33. ast->kind = ZEND_AST_ZNODE;
  34. ast->attr = 0;
  35. ast->lineno = CG(zend_lineno);
  36. ast->node = *node;
  37. return (zend_ast *) ast;
  38. }
  39.  
  40. static zend_always_inline zend_ast * zend_ast_create_zval_int(zval *zv, uint32_t attr, uint32_t lineno) {
  41. zend_ast_zval *ast;
  42.  
  43. ast = zend_ast_alloc(sizeof(zend_ast_zval));
  44. ast->kind = ZEND_AST_ZVAL;
  45. ast->attr = attr;
  46. ZVAL_COPY_VALUE(&ast->val, zv);
  47. Z_LINENO(ast->val) = lineno;
  48. return (zend_ast *) ast;
  49. }
Add Comment
Please, Sign In to add comment