@@ -133,7 +133,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
133
133
const char *func)
134
134
{
135
135
zval local_zv_tz;
136
- TimeZone * timeZone;
136
+ std::unique_ptr< TimeZone> timeZone;
137
137
138
138
if (zv_timezone == NULL || Z_TYPE_P (zv_timezone) == IS_NULL) {
139
139
timelib_tzinfo *tzinfo = get_timezone_info ();
@@ -153,7 +153,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
153
153
zval_ptr_dtor_str (&local_zv_tz);
154
154
return NULL ;
155
155
}
156
- timeZone = to->utimezone ->clone ();
156
+ timeZone = std::unique_ptr<TimeZone>( to->utimezone ->clone () );
157
157
if (UNEXPECTED (timeZone == NULL )) {
158
158
zend_throw_error (IntlException_ce_ptr, " %s: could not clone TimeZone" , func);
159
159
zval_ptr_dtor_str (&local_zv_tz);
@@ -181,7 +181,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
181
181
zval_ptr_dtor_str (&local_zv_tz);
182
182
return NULL ;
183
183
}
184
- timeZone = TimeZone::createTimeZone (id);
184
+ timeZone = std::unique_ptr< TimeZone>( TimeZone ::createTimeZone (id) );
185
185
if (UNEXPECTED (timeZone == NULL )) {
186
186
zend_throw_error (IntlException_ce_ptr, " %s: Could not create time zone" , func);
187
187
zval_ptr_dtor_str (&local_zv_tz);
@@ -191,14 +191,14 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
191
191
zend_throw_error (IntlException_ce_ptr, " %s: No such time zone: '%s'" ,
192
192
func, Z_STRVAL_P (zv_timezone));
193
193
zval_ptr_dtor_str (&local_zv_tz);
194
- delete timeZone;
195
194
return NULL ;
196
195
}
197
196
}
198
197
199
198
zval_ptr_dtor_str (&local_zv_tz);
200
199
201
- return timeZone;
200
+ // well, this is included by the centralized C intl part so the "smart" part can't go further
201
+ return timeZone.release ();
202
202
}
203
203
/* }}} */
204
204
0 commit comments