]> granicus.if.org Git - php/commitdiff
Nuke the old error code, use the new one
authorZeev Suraski <zeev@php.net>
Fri, 2 Jun 2000 12:21:49 +0000 (12:21 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 2 Jun 2000 12:21:49 +0000 (12:21 +0000)
Zend/zend.c
Zend/zend.h
Zend/zend_config.w32.h

index b95b006e04d175ca2e9f1f31ba1c8d4eaf2670c0..d1677088a0f3290c55c60834dec80a9541bdfaa2 100644 (file)
@@ -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
-
index 7dccd1710054fa352cfbcd617695a6a93ab42db2..cb9a20b2af2182f12f6bc0f31c663704bb4eecd9 100644 (file)
@@ -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);
 
index 78b525f33429dd3fd3782b253c16e060d9c0f2df..8b60474bbf92a18ffc9198f19ba0898f4a3d0448 100644 (file)
@@ -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