From: Antony Dovgal Date: Thu, 18 Jan 2007 12:13:05 +0000 (+0000) Subject: fix folding, mark functions as unicode safe X-Git-Tag: RELEASE_1_0_0RC1~235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93ecf75a1f986b092e74e83ddfa7d9f485d32634;p=php fix folding, mark functions as unicode safe --- diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index e6fdacf68a..fb50734f06 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -33,7 +33,7 @@ static zend_object_handlers default_exception_handlers; ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); -void zend_throw_exception_internal(zval *exception TSRMLS_DC) +void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ { if (exception != NULL) { if (EG(exception)) { @@ -58,11 +58,9 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) EG(opline_before_exception) = EG(current_execute_data)->opline; EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1]; } +/* }}} */ - - - -ZEND_API void zend_clear_exception(TSRMLS_D) +ZEND_API void zend_clear_exception(TSRMLS_D) /* {{{ */ { if (!EG(exception)) { return; @@ -74,8 +72,9 @@ ZEND_API void zend_clear_exception(TSRMLS_D) EG(opline_before_exception) = NULL; #endif } +/* }}} */ -static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) +static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */ { zval tmp, obj; zend_object *object; @@ -99,19 +98,21 @@ static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_t return Z_OBJVAL(obj); } +/* }}} */ -static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) +static zend_object_value zend_default_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { return zend_default_exception_new_ex(class_type, 0 TSRMLS_CC); } +/* }}} */ -static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) +static zend_object_value zend_error_exception_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { return zend_default_exception_new_ex(class_type, 2 TSRMLS_CC); } +/* }}} */ - -/* {{{ proto Exception Exception::__clone() +/* {{{ proto Exception Exception::__clone() U Clone the exception object */ ZEND_METHOD(exception, __clone) { @@ -120,8 +121,7 @@ ZEND_METHOD(exception, __clone) } /* }}} */ - -/* {{{ proto Exception::__construct(string message, int code) +/* {{{ proto Exception::__construct(string message, int code) U Exception constructor */ ZEND_METHOD(exception, __construct) { @@ -151,8 +151,7 @@ ZEND_METHOD(exception, __construct) } /* }}} */ - -/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno]]) +/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno]]) U ErrorException constructor */ ZEND_METHOD(error_exception, __construct) { @@ -201,7 +200,7 @@ ZEND_METHOD(error_exception, __construct) ZEND_WRONG_PARAM_COUNT(); \ } -static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) +static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval *value; @@ -211,9 +210,9 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len, zval_copy_ctor(return_value); INIT_PZVAL(return_value); } +/* }}} */ - -/* {{{ proto string Exception::getFile() +/* {{{ proto string Exception::getFile() U Get the file in which the exception occurred */ ZEND_METHOD(exception, getFile) { @@ -223,8 +222,7 @@ ZEND_METHOD(exception, getFile) } /* }}} */ - -/* {{{ proto int Exception::getLine() +/* {{{ proto int Exception::getLine() U Get the line in which the exception occurred */ ZEND_METHOD(exception, getLine) { @@ -234,8 +232,7 @@ ZEND_METHOD(exception, getLine) } /* }}} */ - -/* {{{ proto string Exception::getMessage() +/* {{{ proto string Exception::getMessage() U Get the exception message */ ZEND_METHOD(exception, getMessage) { @@ -245,8 +242,7 @@ ZEND_METHOD(exception, getMessage) } /* }}} */ - -/* {{{ proto int Exception::getCode() +/* {{{ proto int Exception::getCode() U Get the exception code */ ZEND_METHOD(exception, getCode) { @@ -256,8 +252,7 @@ ZEND_METHOD(exception, getCode) } /* }}} */ - -/* {{{ proto array Exception::getTrace() +/* {{{ proto array Exception::getTrace() U Get the stack trace for the location in which the exception occurred */ ZEND_METHOD(exception, getTrace) { @@ -267,8 +262,7 @@ ZEND_METHOD(exception, getTrace) } /* }}} */ - -/* {{{ proto int ErrorException::getSeverity() +/* {{{ proto int ErrorException::getSeverity() U Get the exception severity */ ZEND_METHOD(error_exception, getSeverity) { @@ -278,7 +272,7 @@ ZEND_METHOD(error_exception, getSeverity) } /* }}} */ -/* {{{ ZEND_METHOD(exception, gettraceasstring) */ +/* {{{ gettraceasstring() macros */ #define TRACE_APPEND_CHR(chr) \ *str = (char*)erealloc(*str, *len + 1 + 1); \ (*str)[(*len)++] = chr @@ -328,8 +322,9 @@ ZEND_METHOD(error_exception, getSeverity) TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \ } \ } +/* }}} */ -static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key) +static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char **str; int *len; @@ -467,8 +462,9 @@ static int _build_trace_args(zval **arg, int num_args, va_list args, zend_hash_k } return ZEND_HASH_APPLY_KEEP; } +/* }}} */ -static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key) +static int _build_trace_string(zval **frame, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char *s_tmp, **str; int *len, *num; @@ -512,9 +508,9 @@ static int _build_trace_string(zval **frame, int num_args, va_list args, zend_ha TRACE_APPEND_STR(")\n"); return ZEND_HASH_APPLY_KEEP; } +/* }}} */ - -/* {{{ proto string Exception::getTraceAsString() +/* {{{ proto string Exception::getTraceAsString() U Obtain the backtrace for the exception as a string (instead of an array) */ ZEND_METHOD(exception, getTraceAsString) { @@ -535,7 +531,7 @@ ZEND_METHOD(exception, getTraceAsString) } /* }}} */ -int zend_spprintf(char **message, int max_len, char *format, ...) +int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ { va_list arg; int len; @@ -545,9 +541,9 @@ int zend_spprintf(char **message, int max_len, char *format, ...) va_end(arg); return len; } +/* }}} */ - -/* {{{ proto string Exception::__toString() +/* {{{ proto string Exception::__toString() U Obtain the string representation of the Exception object */ ZEND_METHOD(exception, __toString) { @@ -608,6 +604,7 @@ ZEND_METHOD(exception, __toString) } /* }}} */ +/* {{{ internals structs */ /* All functions that may be used in uncaught exception handlers must be final * and must not throw exceptions. Otherwise we would need a facility to handle * such exceptions in that handler. @@ -650,8 +647,9 @@ static zend_function_entry error_exception_functions[] = { ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) {NULL, NULL, NULL} }; +/* }}} */ -void zend_register_default_exception(TSRMLS_D) +void zend_register_default_exception(TSRMLS_D) /* {{{ */ { zend_class_entry ce; @@ -673,19 +671,21 @@ void zend_register_default_exception(TSRMLS_D) error_exception_ce->create_object = zend_error_exception_new; zend_declare_property_long(error_exception_ce, "severity", sizeof("severity")-1, E_ERROR, ZEND_ACC_PROTECTED TSRMLS_CC); } +/* }}} */ -ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) +ZEND_API zend_class_entry *zend_exception_get_default(TSRMLS_D) /* {{{ */ { return default_exception_ce; } +/* }}} */ -ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) +ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */ { return error_exception_ce; } +/* }}} */ - -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC) /* {{{ */ { zval *ex; @@ -711,9 +711,9 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, char *messa zend_throw_exception_internal(ex TSRMLS_CC); return ex; } +/* }}} */ - -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -726,16 +726,17 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod efree(message); return zexception; } +/* }}} */ - -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char *message, long code, int severity TSRMLS_DC) /* {{{ */ { zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); return ex; } +/* }}} */ -static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) +static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */ { va_list args; @@ -743,9 +744,10 @@ static void zend_error_va(int type, const char *file, uint lineno, const char *f zend_error_cb(type, file, lineno, format, args); va_end(args); } +/* }}} */ /* This function doesn't return as it calls E_ERROR */ -ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) +ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) /* {{{ */ { zend_class_entry *ce_exception = Z_OBJCE_P(exception); if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) { @@ -794,9 +796,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) zend_error(E_ERROR, "Uncaught exception '%v'", ce_exception->name); } } +/* }}} */ - -ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) +ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) /* {{{ */ { zend_class_entry *exception_ce; @@ -811,6 +813,7 @@ ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) } zend_throw_exception_internal(exception TSRMLS_CC); } +/* }}} */ /* * Local variables: