@@ -41,14 +41,13 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, __construct)
41
41
0 );
42
42
}
43
43
44
- static void _breakiter_factory (const char *func_name,
45
- BreakIterator *(*func)(const Locale&, UErrorCode&),
46
- INTERNAL_FUNCTION_PARAMETERS)
44
+ static void _breakiter_factory (
45
+ BreakIterator *(*func)(const Locale&, UErrorCode&),
46
+ INTERNAL_FUNCTION_PARAMETERS)
47
47
{
48
48
BreakIterator *biter;
49
49
char *locale_str = NULL ;
50
50
size_t dummy;
51
- char *msg;
52
51
UErrorCode status = UErrorCode ();
53
52
intl_error_reset (NULL );
54
53
@@ -64,10 +63,7 @@ static void _breakiter_factory(const char *func_name,
64
63
biter = func (Locale::createFromName (locale_str), status);
65
64
intl_error_set_code (NULL , status);
66
65
if (U_FAILURE (status)) {
67
- spprintf (&msg, 0 , " %s: error creating BreakIterator" ,
68
- func_name);
69
- intl_error_set_custom_msg (NULL , msg, 1 );
70
- efree (msg);
66
+ intl_error_set_custom_msg (NULL , " error creating BreakIterator" );
71
67
RETURN_NULL ();
72
68
}
73
69
@@ -76,35 +72,35 @@ static void _breakiter_factory(const char *func_name,
76
72
77
73
U_CFUNC PHP_METHOD (IntlBreakIterator, createWordInstance)
78
74
{
79
- _breakiter_factory (" breakiter_create_word_instance " ,
75
+ _breakiter_factory (
80
76
&BreakIterator::createWordInstance,
81
77
INTERNAL_FUNCTION_PARAM_PASSTHRU);
82
78
}
83
79
84
80
U_CFUNC PHP_METHOD (IntlBreakIterator, createLineInstance)
85
81
{
86
- _breakiter_factory (" breakiter_create_line_instance " ,
82
+ _breakiter_factory (
87
83
&BreakIterator::createLineInstance,
88
84
INTERNAL_FUNCTION_PARAM_PASSTHRU);
89
85
}
90
86
91
87
U_CFUNC PHP_METHOD (IntlBreakIterator, createCharacterInstance)
92
88
{
93
- _breakiter_factory (" breakiter_create_character_instance " ,
89
+ _breakiter_factory (
94
90
&BreakIterator::createCharacterInstance,
95
91
INTERNAL_FUNCTION_PARAM_PASSTHRU);
96
92
}
97
93
98
94
U_CFUNC PHP_METHOD (IntlBreakIterator, createSentenceInstance)
99
95
{
100
- _breakiter_factory (" breakiter_create_sentence_instance " ,
96
+ _breakiter_factory (
101
97
&BreakIterator::createSentenceInstance,
102
98
INTERNAL_FUNCTION_PARAM_PASSTHRU);
103
99
}
104
100
105
101
U_CFUNC PHP_METHOD (IntlBreakIterator, createTitleInstance)
106
102
{
107
- _breakiter_factory (" breakiter_create_title_instance " ,
103
+ _breakiter_factory (
108
104
&BreakIterator::createTitleInstance,
109
105
INTERNAL_FUNCTION_PARAM_PASSTHRU);
110
106
}
@@ -149,12 +145,11 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, setText)
149
145
BREAKITER_METHOD_FETCH_OBJECT;
150
146
151
147
ut = utext_openUTF8 (ut, ZSTR_VAL (text), ZSTR_LEN (text), BREAKITER_ERROR_CODE_P (bio));
152
- INTL_METHOD_CHECK_STATUS (bio, " breakiter_set_text: error opening UText" );
148
+ INTL_METHOD_CHECK_STATUS (bio, " error opening UText" );
153
149
154
150
bio->biter ->setText (ut, BREAKITER_ERROR_CODE (bio));
155
151
utext_close (ut); /* ICU shallow clones the UText */
156
- INTL_METHOD_CHECK_STATUS (bio, " breakiter_set_text: error calling "
157
- " BreakIterator::setText()" );
152
+ INTL_METHOD_CHECK_STATUS (bio, " error calling BreakIterator::setText()" );
158
153
159
154
/* When ICU clones the UText, it does not copy the buffer, so we have to
160
155
* keep the string buffer around by holding a reference to its zval. This
@@ -302,19 +297,18 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, getLocale)
302
297
Z_PARAM_LONG (locale_type)
303
298
ZEND_PARSE_PARAMETERS_END ();
304
299
305
- /* Change to ValueError? */
300
+ /* TODO: Change to ValueError? */
306
301
if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) {
307
302
intl_error_set (NULL , U_ILLEGAL_ARGUMENT_ERROR,
308
- " breakiter_get_locale: invalid locale type" , 0 );
303
+ " invalid locale type" );
309
304
RETURN_FALSE;
310
305
}
311
306
312
307
BREAKITER_METHOD_FETCH_OBJECT;
313
308
314
309
Locale locale = bio->biter ->getLocale ((ULocDataLocaleType)locale_type,
315
310
BREAKITER_ERROR_CODE (bio));
316
- INTL_METHOD_CHECK_STATUS (bio,
317
- " breakiter_get_locale: Call to ICU method has failed" );
311
+ INTL_METHOD_CHECK_STATUS (bio, " Call to ICU method has failed" );
318
312
319
313
RETURN_STRING (locale.getName ());
320
314
}
0 commit comments