@@ -3970,40 +3970,36 @@ PHP_FUNCTION(date_diff)
3970
3970
3971
3971
static bool timezone_initialize (php_timezone_obj * tzobj , const zend_string * tz_zstr , char * * warning_message ) /* {{{ */
3972
3972
{
3973
- timelib_time * dummy_t = ecalloc ( 1 , sizeof ( timelib_time )) ;
3973
+ timelib_time dummy_t = { 0 } ;
3974
3974
int dst , not_found ;
3975
3975
const char * tz = ZSTR_VAL (tz_zstr );
3976
3976
3977
3977
ZEND_ASSERT (!zend_str_has_nul_byte (tz_zstr ) && "timezone should have been checked to not have null bytes" );
3978
3978
3979
- dummy_t -> z = timelib_parse_zone (& tz , & dst , dummy_t , & not_found , DATE_TIMEZONEDB , php_date_parse_tzfile_wrapper );
3980
- if ((dummy_t -> z >= (100 * 60 * 60 )) || (dummy_t -> z <= (-100 * 60 * 60 ))) {
3979
+ dummy_t . z = timelib_parse_zone (& tz , & dst , & dummy_t , & not_found , DATE_TIMEZONEDB , php_date_parse_tzfile_wrapper );
3980
+ if ((dummy_t . z >= (100 * 60 * 60 )) || (dummy_t . z <= (-100 * 60 * 60 ))) {
3981
3981
if (warning_message ) {
3982
3982
spprintf (warning_message , 0 , "Timezone offset is out of range (%s)" , ZSTR_VAL (tz_zstr ));
3983
3983
}
3984
- timelib_free (dummy_t -> tz_abbr );
3985
- efree (dummy_t );
3984
+ timelib_free (dummy_t .tz_abbr );
3986
3985
return false;
3987
3986
}
3988
- dummy_t -> dst = dst ;
3987
+ dummy_t . dst = dst ;
3989
3988
if (!not_found && (* tz != '\0' )) {
3990
3989
if (warning_message ) {
3991
3990
spprintf (warning_message , 0 , "Unknown or bad timezone (%s)" , ZSTR_VAL (tz_zstr ));
3992
3991
}
3993
- timelib_free (dummy_t -> tz_abbr );
3994
- efree (dummy_t );
3992
+ timelib_free (dummy_t .tz_abbr );
3995
3993
return false;
3996
3994
}
3997
3995
if (not_found ) {
3998
3996
if (warning_message ) {
3999
3997
spprintf (warning_message , 0 , "Unknown or bad timezone (%s)" , ZSTR_VAL (tz_zstr ));
4000
3998
}
4001
- efree (dummy_t );
4002
3999
return false;
4003
4000
} else {
4004
- set_timezone_from_timelib_time (tzobj , dummy_t );
4005
- timelib_free (dummy_t -> tz_abbr );
4006
- efree (dummy_t );
4001
+ set_timezone_from_timelib_time (tzobj , & dummy_t );
4002
+ timelib_free (dummy_t .tz_abbr );
4007
4003
return true;
4008
4004
}
4009
4005
} /* }}} */
0 commit comments