Commit 7f0dd14b5db for php
commit 7f0dd14b5db1ced830c23f1ab408fc96534718f1
Author: Weilin Du <weilindu@php.net>
Date: Wed Oct 14 00:11:48 2026 +0800
ext/intl: Remove dead code (#24292)
This removes some unused functions/macros in the code base,
diff --git a/ext/intl/collator/collator_class.cpp b/ext/intl/collator/collator_class.cpp
index 4fd991bd156..808f7ae127d 100644
--- a/ext/intl/collator/collator_class.cpp
+++ b/ext/intl/collator/collator_class.cpp
@@ -82,19 +82,6 @@ U_CFUNC void collator_register_Collator_symbols(int module_number)
}
/* }}} */
-/* {{{ void collator_object_init( Collator_object* co )
- * Initialize internals of Collator_object.
- * Must be called before any other call to 'collator_object_...' functions.
- */
-U_CFUNC void collator_object_init( Collator_object* co )
-{
- if( !co )
- return;
-
- intl_error_init( COLLATOR_ERROR_P( co ) );
-}
-/* }}} */
-
/* {{{ void collator_object_destroy( Collator_object* co )
* Clean up mem allocted by internals of Collator_object
*/
diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h
index c4be06fd129..1f1629cce77 100644
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@ -69,7 +69,6 @@ static zend_always_inline zend_result collator_check_initialized(Collator_object
extern "C" {
#endif
void collator_register_Collator_symbols(int module_number);
-void collator_object_init( Collator_object* co );
void collator_object_destroy( Collator_object* co );
#ifdef __cplusplus
}
diff --git a/ext/intl/dateformat/dateformat_data.cpp b/ext/intl/dateformat/dateformat_data.cpp
index 6246257732c..2320a19c1f4 100644
--- a/ext/intl/dateformat/dateformat_data.cpp
+++ b/ext/intl/dateformat/dateformat_data.cpp
@@ -45,16 +45,3 @@ void dateformat_data_free( dateformat_data* datef_data )
intl_error_reset( &datef_data->error );
}
/* }}} */
-
-/* {{{ dateformat_data* dateformat_data_create()
- * Allocate memory for dateformat_data and initialize it with default values.
- */
-dateformat_data* dateformat_data_create( void )
-{
- dateformat_data* datef_data = reinterpret_cast<dateformat_data *>(ecalloc( 1, sizeof(dateformat_data) ));
-
- dateformat_data_init( datef_data );
-
- return datef_data;
-}
-/* }}} */
diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h
index a8dcef4c500..b93b9d78c03 100644
--- a/ext/intl/dateformat/dateformat_data.h
+++ b/ext/intl/dateformat/dateformat_data.h
@@ -37,7 +37,6 @@ typedef struct {
#ifdef __cplusplus
extern "C" {
#endif
-dateformat_data* dateformat_data_create( void );
void dateformat_data_init( dateformat_data* datef_data );
void dateformat_data_free( dateformat_data* datef_data );
#ifdef __cplusplus
diff --git a/ext/intl/formatter/formatter_data.cpp b/ext/intl/formatter/formatter_data.cpp
index 506972e7208..df5560652ea 100644
--- a/ext/intl/formatter/formatter_data.cpp
+++ b/ext/intl/formatter/formatter_data.cpp
@@ -44,16 +44,3 @@ void formatter_data_free( formatter_data* nf_data )
intl_error_reset( &nf_data->error );
}
/* }}} */
-
-/* {{{ formatter_data* formatter_data_create()
- * Alloc mem for formatter_data and initialize it with default values.
- */
-formatter_data* formatter_data_create( void )
-{
- formatter_data* nf_data = reinterpret_cast<formatter_data *>(ecalloc( 1, sizeof(formatter_data) ));
-
- formatter_data_init( nf_data );
-
- return nf_data;
-}
-/* }}} */
diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h
index 46a82cb9bd0..8cacb11315c 100644
--- a/ext/intl/formatter/formatter_data.h
+++ b/ext/intl/formatter/formatter_data.h
@@ -49,7 +49,6 @@ typedef struct {
#ifdef __cplusplus
extern "C" {
#endif
-formatter_data* formatter_data_create( void );
void formatter_data_init( formatter_data* nf_data );
void formatter_data_free( formatter_data* nf_data );
#ifdef __cplusplus
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index cfc16ff2ecb..d664038168f 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -49,17 +49,6 @@ static void intl_free_custom_error_msg( intl_error* err )
}
/* }}} */
-/* {{{ Create and initialize internals of 'intl_error'. */
-intl_error* intl_error_create( void )
-{
- intl_error* err = ecalloc( 1, sizeof( intl_error ) );
-
- intl_error_init( err );
-
- return err;
-}
-/* }}} */
-
/* {{{ Initialize internals of 'intl_error'. */
void intl_error_init( intl_error* err )
{
diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h
index dd13cf84ebd..54fa0bf86f1 100644
--- a/ext/intl/intl_error.h
+++ b/ext/intl/intl_error.h
@@ -28,7 +28,6 @@ typedef struct {
UErrorCode code;
} intl_error;
-intl_error* intl_error_create( void );
void intl_error_init( intl_error* err );
void intl_error_reset( intl_error* err );
void intl_error_set_code( intl_error* err, UErrorCode err_code );
diff --git a/ext/intl/msgformat/msgformat_data.cpp b/ext/intl/msgformat/msgformat_data.cpp
index c629e8a3d81..f36bf9e4ac7 100644
--- a/ext/intl/msgformat/msgformat_data.cpp
+++ b/ext/intl/msgformat/msgformat_data.cpp
@@ -64,19 +64,6 @@ U_CFUNC void msgformat_data_free(msgformat_data* mf_data)
}
/* }}} */
-/* {{{ msgformat_data* msgformat_data_create()
- * Allocate memory for msgformat_data and initialize it with default values.
- */
-msgformat_data* msgformat_data_create( void )
-{
- msgformat_data* mf_data = reinterpret_cast<msgformat_data *>(ecalloc( 1, sizeof(msgformat_data) ));
-
- msgformat_data_init( mf_data );
-
- return mf_data;
-}
-/* }}} */
-
#ifdef MSG_FORMAT_QUOTE_APOS
int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec)
{
diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h
index 121c8360efe..7ca4a5acb1a 100644
--- a/ext/intl/msgformat/msgformat_data.h
+++ b/ext/intl/msgformat/msgformat_data.h
@@ -42,7 +42,6 @@ typedef struct {
#ifdef __cplusplus
extern "C" {
#endif
-msgformat_data* msgformat_data_create( void );
void msgformat_data_init( msgformat_data* mf_data );
void msgformat_data_free( msgformat_data* mf_data );
#ifdef __cplusplus
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index da18527591d..b7d592641bd 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -74,13 +74,6 @@ using icu::MessagePattern;
using icu::MessageFormatAdapter;
using icu::FieldPosition;
-U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
-{
- int32_t fmt_count = 0;
- MessageFormatAdapter::phpGetArgTypeList(*(const MessageFormat*)fmt, fmt_count);
- return fmt_count;
-}
-
static void arg_types_dtor(zval *el) {
efree(Z_PTR_P(el));
}
diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h
index c1a15378351..21f74b29db8 100644
--- a/ext/intl/msgformat/msgformat_helpers.h
+++ b/ext/intl/msgformat/msgformat_helpers.h
@@ -15,7 +15,6 @@
#ifndef MSG_FORMAT_HELPERS_H
#define MSG_FORMAT_HELPERS_H
-int32_t umsg_format_arg_count(UMessageFormat *fmt);
void umsg_format_helper(MessageFormatter_object *mfo, HashTable *args,
UChar **formatted, int *formatted_len);
void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args,
diff --git a/ext/intl/spoofchecker/spoofchecker_class.cpp b/ext/intl/spoofchecker/spoofchecker_class.cpp
index 7f5f66bcc80..8cd9c35cfd2 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.cpp
+++ b/ext/intl/spoofchecker/spoofchecker_class.cpp
@@ -104,20 +104,6 @@ U_CFUNC void spoofchecker_register_Spoofchecker_class(void)
}
/* }}} */
-/* {{{ void spoofchecker_object_init( Spoofchecker_object* co )
- * Initialize internals of Spoofchecker_object.
- * Must be called before any other call to 'spoofchecker_object_...' functions.
- */
-U_CFUNC void spoofchecker_object_init(Spoofchecker_object* co)
-{
- if (!co) {
- return;
- }
-
- intl_error_init(SPOOFCHECKER_ERROR_P(co));
-}
-/* }}} */
-
/* {{{ void spoofchecker_object_destroy( Spoofchecker_object* co )
* Clean up mem allocted by internals of Spoofchecker_object
*/
diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h
index 68d5daf2b5a..347b78e3ffd 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.h
+++ b/ext/intl/spoofchecker/spoofchecker_class.h
@@ -55,7 +55,6 @@ extern "C" {
#endif
void spoofchecker_register_Spoofchecker_class(void);
-void spoofchecker_object_init(Spoofchecker_object* co);
void spoofchecker_object_destroy(Spoofchecker_object* co);
#ifdef __cplusplus
}