Skip to content

Commit 6e75241

Browse files
committed
ext/date: make string pointers const
1 parent df71f8b commit 6e75241

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ext/date/php_date.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ PHPAPI time_t php_time(void)
235235

236236
#include "php_date_arginfo.h"
237237

238-
static char* guess_timezone(const timelib_tzdb *tzdb);
238+
static const char* guess_timezone(const timelib_tzdb *tzdb);
239239
static void date_register_classes(void);
240240
/* }}} */
241241

@@ -531,7 +531,7 @@ static PHP_INI_MH(OnUpdate_date_timezone)
531531
/* }}} */
532532

533533
/* {{{ Helper functions */
534-
static char* guess_timezone(const timelib_tzdb *tzdb)
534+
static const char* guess_timezone(const timelib_tzdb *tzdb)
535535
{
536536
/* Checking whether timezone has been set with date_default_timezone_set() */
537537
if (DATEG(timezone) && (strlen(DATEG(timezone))) > 0) {
@@ -555,10 +555,9 @@ static char* guess_timezone(const timelib_tzdb *tzdb)
555555

556556
PHPAPI timelib_tzinfo *get_timezone_info(void)
557557
{
558-
char *tz;
559558
timelib_tzinfo *tzi;
560559

561-
tz = guess_timezone(DATE_TIMEZONEDB);
560+
const char *tz = guess_timezone(DATE_TIMEZONEDB);
562561
tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB);
563562
if (! tzi) {
564563
zend_throw_error(NULL, "Timezone database is corrupt. Please file a bug report as this should never happen");
@@ -619,7 +618,7 @@ static const char * const day_short_names[] = {
619618
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
620619
};
621620

622-
static char *english_suffix(timelib_sll number)
621+
static const char *english_suffix(timelib_sll number)
623622
{
624623
if (number >= 10 && number <= 19) {
625624
return "th";
@@ -1679,7 +1678,7 @@ static const zend_object_iterator_funcs date_period_it_funcs = {
16791678
NULL, /* get_gc */
16801679
};
16811680

1682-
zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
1681+
static zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
16831682
{
16841683
date_period_it *iterator;
16851684

@@ -2053,7 +2052,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
20532052
}
20542053
}
20552054

2056-
void date_timezone_object_to_hash(php_timezone_obj *tzobj, HashTable *props)
2055+
static void date_timezone_object_to_hash(php_timezone_obj *tzobj, HashTable *props)
20572056
{
20582057
zval zv;
20592058

0 commit comments

Comments
 (0)