Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Some header dependencies cleanup

- Generalize zval_print() and zval_print_r()
  • Loading branch information...
commit 5dba477467304ae627f4a1766e92fe8b74de11ce 1 parent 18e1e63
@zsuraski zsuraski authored
View
2  Zend/zend-parser.y
@@ -33,8 +33,6 @@
#include "zend_list.h"
#include "zend_globals.h"
#include "zend_API.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
#define YYERROR_VERBOSE
#define YYSTYPE znode
View
22 Zend/zend.c
@@ -19,8 +19,6 @@
#include "zend.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
#include "zend_extensions.h"
#include "modules.h"
#include "zend_constants.h"
@@ -41,7 +39,7 @@
/* true multithread-shared globals */
ZEND_API zend_class_entry zend_standard_class_def;
ZEND_API int (*zend_printf)(const char *format, ...);
-ZEND_API int (*zend_write)(const char *str, uint str_length);
+ZEND_API zend_write_func_t zend_write;
ZEND_API void (*zend_error)(int type, const char *format, ...);
ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
ZEND_API void (*zend_block_interruptions)(void);
@@ -163,6 +161,12 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
ZEND_API int zend_print_zval(zval *expr, int indent)
{
+ return zend_print_zval_ex(zend_write, expr, indent);
+}
+
+
+ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent)
+{
zval expr_copy;
int use_copy;
@@ -176,7 +180,7 @@ ZEND_API int zend_print_zval(zval *expr, int indent)
}
return 0;
}
- ZEND_WRITE(expr->value.str.val,expr->value.str.len);
+ write_func(expr->value.str.val,expr->value.str.len);
if (use_copy) {
zval_dtor(expr);
}
@@ -184,7 +188,13 @@ ZEND_API int zend_print_zval(zval *expr, int indent)
}
-ZEND_API void zend_print_zval_r(zval *expr, int indent)
+ZEND_API void zend_print_zval_r(zval *expr, int indent)
+{
+ zend_print_zval_r_ex(zend_write, expr, indent);
+}
+
+
+ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent)
{
switch(expr->type) {
case IS_ARRAY:
@@ -298,7 +308,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
/* Set up utility functions and values */
zend_error = utility_functions->error_function;
zend_printf = utility_functions->printf_function;
- zend_write = utility_functions->write_function;
+ zend_write = (zend_write_func_t) utility_functions->write_function;
zend_fopen = utility_functions->fopen_function;
if (!zend_fopen) {
zend_fopen = zend_fopen_wrapper;
View
8 Zend/zend.h
@@ -237,6 +237,9 @@ typedef struct _zend_utility_values {
} zend_utility_values;
+typedef int (*zend_write_func_t)(const char *str, uint str_length);
+
+
#undef MIN
#undef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
@@ -282,7 +285,9 @@ ZEND_API char *get_zend_version(void);
ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
ZEND_API int zend_print_zval(zval *expr, int indent);
+ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent);
ZEND_API void zend_print_zval_r(zval *expr, int indent);
+ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent);
ZEND_API extern char *empty_string;
@@ -302,9 +307,10 @@ ZEND_API extern char *empty_string;
#define ZEND_PUTS(str) zend_write((str), strlen((str)))
#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
+
BEGIN_EXTERN_C()
extern ZEND_API int (*zend_printf)(const char *format, ...);
-extern ZEND_API int (*zend_write)(const char *str, uint str_length);
+extern ZEND_API zend_write_func_t zend_write;
extern ZEND_API void (*zend_error)(int type, const char *format, ...);
extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path);
extern ZEND_API void (*zend_block_interruptions)(void);
View
2  Zend/zend_API.c
@@ -19,12 +19,10 @@
#include "zend.h"
-#include "zend_variables.h"
#include "zend_execute.h"
#include "zend_API.h"
#include "modules.h"
#include "zend_constants.h"
-#include "zend_operators.h"
#ifdef HAVE_STDARG_H
# include <stdarg.h>
View
2  Zend/zend_API.h
@@ -24,6 +24,8 @@
#include "modules.h"
#include "zend_list.h"
#include "zend_fast_cache.h"
+#include "zend_operators.h"
+#include "zend_variables.h"
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
View
2  Zend/zend_builtin_functions.c
@@ -21,8 +21,6 @@
#include "zend.h"
#include "zend_API.h"
#include "zend_builtin_functions.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
#include "zend_constants.h"
#undef ZEND_TEST_EXCEPTIONS
View
2  Zend/zend_compile.c
@@ -23,8 +23,6 @@
#include "zend_compile.h"
#include "zend_llist.h"
#include "zend_API.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
#include "zend_fast_cache.h"
View
2  Zend/zend_execute.c
@@ -27,8 +27,6 @@
#include "zend_execute.h"
#include "zend_API.h"
#include "zend_ptr_stack.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
#include "zend_constants.h"
#include "zend_extensions.h"
#include "zend_fast_cache.h"
View
2  Zend/zend_execute_API.c
@@ -26,8 +26,6 @@
#include "zend_execute.h"
#include "zend_API.h"
#include "zend_ptr_stack.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
#include "zend_constants.h"
#include "zend_extensions.h"
#include "zend_execute_locks.h"
View
2  Zend/zend_opcode.c
@@ -23,8 +23,6 @@
#include "zend.h"
#include "zend_alloc.h"
#include "zend_compile.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
#include "zend_extensions.h"
#include "zend_API.h"
View
1  Zend/zend_variables.c
@@ -23,7 +23,6 @@
#include "zend_API.h"
#include "zend_globals.h"
#include "zend_constants.h"
-#include "zend_variables.h"
#include "zend_list.h"
ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for
Please sign in to comment.
Something went wrong with that request. Please try again.