diff options
-rw-r--r-- | Zend/zend.c | 16 | ||||
-rw-r--r-- | Zend/zend.h | 11 | ||||
-rw-r--r-- | Zend/zend_config.w32.h | 5 |
3 files changed, 11 insertions, 21 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index b95b006e04..d1677088a0 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -47,11 +47,7 @@ ZEND_API void (*zend_ticks_function)(int ticks); static void (*zend_message_dispatcher_p)(long message, void *data); static int (*zend_get_ini_entry_p)(char *name, uint name_length, zval *contents); -#if ZEND_NEW_ERROR_HANDLING static void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); -#else -ZEND_API void (*zend_error_cb)(int type, const char *format, ...); -#endif #ifdef ZTS ZEND_API int compiler_globals_id; @@ -498,9 +494,6 @@ ZEND_API int zend_get_ini_entry(char *name, uint name_length, zval *contents) } - -#if ZEND_NEW_ERROR_HANDLING - #define ZEND_ERROR_BUFFER_SIZE 1024 ZEND_API void zend_error(int type, const char *format, ...) @@ -552,6 +545,7 @@ ZEND_API void zend_error(int type, const char *format, ...) va_start(args, format); + /* if we don't have a user defined error handler */ if (!EG(user_error_handler)) { zend_error_cb(type, error_filename, error_lineno, format, args); @@ -571,8 +565,12 @@ ZEND_API void zend_error(int type, const char *format, ...) INIT_PZVAL(&error_type); error_message.value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE); - /* error_message.value.str.len = vsnprintf(error_message->value.str.val, error_message->value.str.len-1, format, args); */ +#ifdef HAVE_VSNPRINTF + error_message.value.str.len = vsnprintf(error_message.value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args); +#else + /* This is risky... */ error_message.value.str.len = vsprintf(error_message.value.str.val, format, args); +#endif error_message.type = IS_STRING; error_type.value.lval = type; @@ -596,5 +594,3 @@ ZEND_API void zend_error(int type, const char *format, ...) va_end(args); } -#endif - diff --git a/Zend/zend.h b/Zend/zend.h index 7dccd17100..cb9a20b2af 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -23,8 +23,6 @@ #define ZEND_VERSION "1.00" -#define ZEND_NEW_ERROR_HANDLING 0 - #ifdef __cplusplus #define BEGIN_EXTERN_C() extern "C" { #define END_EXTERN_C() } @@ -221,11 +219,7 @@ struct _zend_class_entry { typedef struct _zend_utility_functions { -#if ZEND_NEW_ERROR_HANDLING void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); -#else - void (*error_function)(int type, const char *format, ...); -#endif int (*printf_function)(const char *format, ...); int (*write_function)(const char *str, uint str_length); FILE *(*fopen_function)(const char *filename, char **opened_path); @@ -327,12 +321,7 @@ extern ZEND_API void (*zend_unblock_interruptions)(void); extern ZEND_API void (*zend_ticks_function)(int ticks); -#if ZEND_NEW_ERROR_HANDLING ZEND_API void zend_error(int type, const char *format, ...); -#else -#define zend_error zend_error_cb -ZEND_API void (*zend_error_cb)(int type, const char *format, ...); -#endif void zenderror(char *error); diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h index 78b525f334..8b60474bbf 100644 --- a/Zend/zend_config.w32.h +++ b/Zend/zend_config.w32.h @@ -42,6 +42,11 @@ typedef unsigned int uint; #define HAVE_STDIOSTR_H 1 #define HAVE_CLASS_ISTDIOSTREAM #define istdiostream stdiostream +#define HAVE_STDARG_H 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 + +#define vsnprintf _vsnprintf #ifdef inline #undef inline |