@@ -133,7 +133,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
133133 const char *func)
134134{
135135 zval local_zv_tz;
136- TimeZone * timeZone;
136+ std::unique_ptr< TimeZone> timeZone;
137137
138138 if (zv_timezone == NULL || Z_TYPE_P (zv_timezone) == IS_NULL) {
139139 timelib_tzinfo *tzinfo = get_timezone_info ();
@@ -153,7 +153,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
153153 zval_ptr_dtor_str (&local_zv_tz);
154154 return NULL ;
155155 }
156- timeZone = to->utimezone ->clone ();
156+ timeZone = std::unique_ptr<TimeZone>( to->utimezone ->clone () );
157157 if (UNEXPECTED (timeZone == NULL )) {
158158 zend_throw_error (IntlException_ce_ptr, " %s: could not clone TimeZone" , func);
159159 zval_ptr_dtor_str (&local_zv_tz);
@@ -181,7 +181,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
181181 zval_ptr_dtor_str (&local_zv_tz);
182182 return NULL ;
183183 }
184- timeZone = TimeZone::createTimeZone (id);
184+ timeZone = std::unique_ptr< TimeZone>( TimeZone ::createTimeZone (id) );
185185 if (UNEXPECTED (timeZone == NULL )) {
186186 zend_throw_error (IntlException_ce_ptr, " %s: Could not create time zone" , func);
187187 zval_ptr_dtor_str (&local_zv_tz);
@@ -191,14 +191,14 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
191191 zend_throw_error (IntlException_ce_ptr, " %s: No such time zone: '%s'" ,
192192 func, Z_STRVAL_P (zv_timezone));
193193 zval_ptr_dtor_str (&local_zv_tz);
194- delete timeZone;
195194 return NULL ;
196195 }
197196 }
198197
199198 zval_ptr_dtor_str (&local_zv_tz);
200199
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 ();
202202}
203203/* }}} */
204204
0 commit comments