summaryrefslogtreecommitdiff
path: root/ext/intl/intl_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl/intl_error.c')
-rw-r--r--ext/intl/intl_error.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index 99b1c6001c..28a2a244e2 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -34,7 +34,7 @@ static zend_class_entry *IntlException_ce_ptr;
/* {{{ intl_error* intl_g_error_get()
* Return global error structure.
*/
-static intl_error* intl_g_error_get( TSRMLS_D )
+static intl_error* intl_g_error_get( void )
{
return &INTL_G( g_error );
}
@@ -43,9 +43,9 @@ static intl_error* intl_g_error_get( TSRMLS_D )
/* {{{ void intl_free_custom_error_msg( intl_error* err )
* Free mem.
*/
-static void intl_free_custom_error_msg( intl_error* err TSRMLS_DC )
+static void intl_free_custom_error_msg( intl_error* err )
{
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return;
if(err->free_custom_error_message ) {
@@ -60,11 +60,11 @@ static void intl_free_custom_error_msg( intl_error* err TSRMLS_DC )
/* {{{ intl_error* intl_error_create()
* Create and initialize internals of 'intl_error'.
*/
-intl_error* intl_error_create( TSRMLS_D )
+intl_error* intl_error_create( void )
{
intl_error* err = ecalloc( 1, sizeof( intl_error ) );
- intl_error_init( err TSRMLS_CC );
+ intl_error_init( err );
return err;
}
@@ -73,9 +73,9 @@ intl_error* intl_error_create( TSRMLS_D )
/* {{{ void intl_error_init( intl_error* coll_error )
* Initialize internals of 'intl_error'.
*/
-void intl_error_init( intl_error* err TSRMLS_DC )
+void intl_error_init( intl_error* err )
{
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return;
err->code = U_ZERO_ERROR;
@@ -87,36 +87,36 @@ void intl_error_init( intl_error* err TSRMLS_DC )
/* {{{ void intl_error_reset( intl_error* err )
* Set last error code to 0 and unset last error message
*/
-void intl_error_reset( intl_error* err TSRMLS_DC )
+void intl_error_reset( intl_error* err )
{
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return;
err->code = U_ZERO_ERROR;
- intl_free_custom_error_msg( err TSRMLS_CC );
+ intl_free_custom_error_msg( err );
}
/* }}} */
/* {{{ void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg )
* Set last error message to msg copying it if needed.
*/
-void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC )
+void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg )
{
if( !msg )
return;
if( !err ) {
if( INTL_G( error_level ) )
- php_error_docref( NULL TSRMLS_CC, INTL_G( error_level ), "%s", msg );
+ php_error_docref( NULL, INTL_G( error_level ), "%s", msg );
if( INTL_G( use_exceptions ) )
- zend_throw_exception_ex( IntlException_ce_ptr, 0 TSRMLS_CC, "%s", msg );
+ zend_throw_exception_ex( IntlException_ce_ptr, 0, "%s", msg );
}
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return;
/* Free previous message if any */
- intl_free_custom_error_msg( err TSRMLS_CC );
+ intl_free_custom_error_msg( err );
/* Mark message copied if any */
err->free_custom_error_message = copyMsg;
@@ -129,24 +129,24 @@ void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_D
/* {{{ const char* intl_error_get_message( intl_error* err )
* Create output message in format "<intl_error_text>: <extra_user_error_text>".
*/
-char* intl_error_get_message( intl_error* err TSRMLS_DC )
+zend_string * intl_error_get_message( intl_error* err )
{
- const char* uErrorName = NULL;
- char* errMessage = 0;
+ const char *uErrorName = NULL;
+ zend_string *errMessage = 0;
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
- return estrdup( "" );
+ if( !err && !( err = intl_g_error_get( ) ) )
+ return STR_EMPTY_ALLOC();
uErrorName = u_errorName( err->code );
/* Format output string */
if( err->custom_error_message )
{
- spprintf( &errMessage, 0, "%s: %s", err->custom_error_message, uErrorName );
+ errMessage = strpprintf(0, "%s: %s", err->custom_error_message, uErrorName );
}
else
{
- spprintf( &errMessage, 0, "%s", uErrorName );
+ errMessage = strpprintf(0, "%s", uErrorName );
}
return errMessage;
@@ -156,9 +156,9 @@ char* intl_error_get_message( intl_error* err TSRMLS_DC )
/* {{{ void intl_error_set_code( intl_error* err, UErrorCode err_code )
* Set last error code.
*/
-void intl_error_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC )
+void intl_error_set_code( intl_error* err, UErrorCode err_code )
{
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return;
err->code = err_code;
@@ -168,9 +168,9 @@ void intl_error_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC )
/* {{{ void intl_error_get_code( intl_error* err )
* Return last error code.
*/
-UErrorCode intl_error_get_code( intl_error* err TSRMLS_DC )
+UErrorCode intl_error_get_code( intl_error* err )
{
- if( !err && !( err = intl_g_error_get( TSRMLS_C ) ) )
+ if( !err && !( err = intl_g_error_get( ) ) )
return U_ZERO_ERROR;
return err->code;
@@ -180,67 +180,67 @@ UErrorCode intl_error_get_code( intl_error* err TSRMLS_DC )
/* {{{ void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg )
* Set error code and message.
*/
-void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC )
+void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg )
{
- intl_error_set_code( err, code TSRMLS_CC );
- intl_error_set_custom_msg( err, msg, copyMsg TSRMLS_CC );
+ intl_error_set_code( err, code );
+ intl_error_set_custom_msg( err, msg, copyMsg );
}
/* }}} */
/* {{{ void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg )
* Set error code and message.
*/
-void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg TSRMLS_DC )
+void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg )
{
- intl_errors_set_code( err, code TSRMLS_CC );
- intl_errors_set_custom_msg( err, msg, copyMsg TSRMLS_CC );
+ intl_errors_set_code( err, code );
+ intl_errors_set_custom_msg( err, msg, copyMsg );
}
/* }}} */
/* {{{ void intl_errors_reset( intl_error* err )
*/
-void intl_errors_reset( intl_error* err TSRMLS_DC )
+void intl_errors_reset( intl_error* err )
{
if(err) {
- intl_error_reset( err TSRMLS_CC );
+ intl_error_reset( err );
}
- intl_error_reset( NULL TSRMLS_CC );
+ intl_error_reset( NULL );
}
/* }}} */
/* {{{ void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg )
*/
-void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg TSRMLS_DC )
+void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg )
{
if(err) {
- intl_error_set_custom_msg( err, msg, copyMsg TSRMLS_CC );
+ intl_error_set_custom_msg( err, msg, copyMsg );
}
- intl_error_set_custom_msg( NULL, msg, copyMsg TSRMLS_CC );
+ intl_error_set_custom_msg( NULL, msg, copyMsg );
}
/* }}} */
/* {{{ intl_errors_set_code( intl_error* err, UErrorCode err_code )
*/
-void intl_errors_set_code( intl_error* err, UErrorCode err_code TSRMLS_DC )
+void intl_errors_set_code( intl_error* err, UErrorCode err_code )
{
if(err) {
- intl_error_set_code( err, err_code TSRMLS_CC );
+ intl_error_set_code( err, err_code );
}
- intl_error_set_code( NULL, err_code TSRMLS_CC );
+ intl_error_set_code( NULL, err_code );
}
/* }}} */
-void intl_register_IntlException_class( TSRMLS_D )
+void intl_register_IntlException_class( void )
{
zend_class_entry ce,
*default_exception_ce;
- default_exception_ce = zend_exception_get_default( TSRMLS_C );
+ default_exception_ce = zend_exception_get_default( );
/* Create and register 'IntlException' class. */
INIT_CLASS_ENTRY_EX( ce, "IntlException", sizeof( "IntlException" ) - 1, NULL );
IntlException_ce_ptr = zend_register_internal_class_ex( &ce,
- default_exception_ce, NULL TSRMLS_CC );
+ default_exception_ce );
IntlException_ce_ptr->create_object = default_exception_ce->create_object;
}
@@ -248,7 +248,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
{
smart_str ret = {0};
char *buf;
- int u8len;
+ size_t u8len;
UErrorCode status;
int any = 0;
@@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
if( pe->line > 0 )
{
smart_str_appends( &ret, "on line " );
- smart_str_append_long( &ret, (long ) pe->line );
+ smart_str_append_long( &ret, (zend_long ) pe->line );
any = 1;
}
if( pe->offset >= 0 ) {
@@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
smart_str_appends( &ret, "at " );
smart_str_appends( &ret, "offset " );
- smart_str_append_long( &ret, (long ) pe->offset );
+ smart_str_append_long( &ret, (zend_long ) pe->offset );
any = 1;
}
@@ -315,7 +315,7 @@ smart_str intl_parse_error_to_string( UParseError* pe )
smart_str_free( &ret );
smart_str_appends( &ret, "no parse error" );
}
-
+
smart_str_0( &ret );
return ret;
}