Skip to content

Commit abee5c1

Browse files
authored
ext/intl: convert C part to C++ step 1. (#19231)
1 parent e8b5bcf commit abee5c1

File tree

8 files changed

+59
-50
lines changed

8 files changed

+59
-50
lines changed

ext/intl/config.m4

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ if test "$PHP_INTL" != "no"; then
3333
formatter/formatter_parse.c
3434
grapheme/grapheme_string.c
3535
grapheme/grapheme_util.c
36-
idn/idn.c
3736
intl_convert.c
3837
intl_error.c
39-
locale/locale_class.c
40-
locale/locale_methods.c
41-
locale/locale.c
4238
listformatter/listformatter_class.c
4339
msgformat/msgformat_attr.c
4440
msgformat/msgformat_class.c
@@ -57,7 +53,6 @@ if test "$PHP_INTL" != "no"; then
5753
spoofchecker/spoofchecker_main.c
5854
transliterator/transliterator_class.c
5955
transliterator/transliterator_methods.c
60-
uchar/uchar.c
6156
]),
6257
[$ext_shared],,
6358
[$INTL_COMMON_FLAGS],
@@ -83,7 +78,12 @@ if test "$PHP_INTL" != "no"; then
8378
breakiterator/breakiterator_methods.cpp \
8479
breakiterator/rulebasedbreakiterator_methods.cpp \
8580
breakiterator/codepointiterator_internal.cpp \
86-
breakiterator/codepointiterator_methods.cpp"
81+
breakiterator/codepointiterator_methods.cpp \
82+
idn/idn.cpp \
83+
locale/locale_class.cpp \
84+
locale/locale_methods.cpp \
85+
locale/locale.cpp \
86+
uchar/uchar.cpp"
8787

8888
PHP_REQUIRE_CXX()
8989

ext/intl/config.w32

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ if (PHP_INTL != "no") {
4343
listformatter_class.c \
4444
", "intl");
4545
ADD_SOURCES(configure_module_dirname + "/locale", "\
46-
locale.c \
47-
locale_class.c \
48-
locale_methods.c \
46+
locale.cpp \
47+
locale_class.cpp \
48+
locale_methods.cpp \
4949
", "intl");
5050
ADD_SOURCES(configure_module_dirname + "/msgformat", "\
5151
msgformat.c \
@@ -78,10 +78,10 @@ if (PHP_INTL != "no") {
7878
datepatterngenerator_methods.cpp \
7979
", "intl");
8080
ADD_SOURCES(configure_module_dirname + "/uchar", "\
81-
uchar.c",
81+
uchar.cpp",
8282
"intl");
8383
ADD_SOURCES(configure_module_dirname + "/idn", "\
84-
idn.c",
84+
idn.cpp",
8585
"intl");
8686
ADD_SOURCES(configure_module_dirname + "/resourcebundle", "\
8787
resourcebundle.c \

ext/intl/idn/idn.c renamed to ext/intl/idn/idn.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
#include <unicode/ustring.h>
2727

2828
#include "idn.h"
29+
30+
extern "C" {
2931
#include "intl_error.h"
32+
}
3033
/* }}} */
3134

3235
enum {
@@ -145,15 +148,15 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
145148
}
146149

147150
/* {{{ Converts an Unicode domain to ASCII representation, as defined in the IDNA RFC */
148-
PHP_FUNCTION(idn_to_ascii)
151+
U_CFUNC PHP_FUNCTION(idn_to_ascii)
149152
{
150153
php_intl_idn_handoff(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTL_IDN_TO_ASCII);
151154
}
152155
/* }}} */
153156

154157

155158
/* {{{ Converts an ASCII representation of the domain to Unicode (UTF-8), as defined in the IDNA RFC */
156-
PHP_FUNCTION(idn_to_utf8)
159+
U_CFUNC PHP_FUNCTION(idn_to_utf8)
157160
{
158161
php_intl_idn_handoff(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTL_IDN_TO_UTF8);
159162
}
File renamed without changes.

ext/intl/locale/locale_class.c renamed to ext/intl/locale/locale_class.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
*/
1414

1515
#include <unicode/uloc.h>
16+
extern "C" {
1617
#include "php_intl.h"
1718
#include "intl_error.h"
1819
#include "locale_class.h"
1920
#include "locale.h"
2021
#include "locale_arginfo.h"
22+
}
2123

2224
zend_class_entry *Locale_ce_ptr = NULL;
2325

@@ -28,7 +30,7 @@ zend_class_entry *Locale_ce_ptr = NULL;
2830
/* {{{ locale_register_Locale_class
2931
* Initialize 'Locale' class
3032
*/
31-
void locale_register_Locale_class( void )
33+
U_CFUNC void locale_register_Locale_class( void )
3234
{
3335
/* Create and register 'Locale' class. */
3436
Locale_ce_ptr = register_class_Locale();

ext/intl/locale/locale_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef struct {
3131
} Locale_object;
3232

3333

34-
void locale_register_Locale_class( void );
34+
U_CFUNC void locale_register_Locale_class( void );
3535

3636
extern zend_class_entry *Locale_ce_ptr;
3737

0 commit comments

Comments
 (0)