Skip to content

Commit cbaa05a

Browse files
committed
ext/date: make string pointers const
1 parent cdc1c8f commit cbaa05a

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");
@@ -589,7 +588,7 @@ static const char * const day_short_names[] = {
589588
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
590589
};
591590

592-
static char *english_suffix(timelib_sll number)
591+
static const char *english_suffix(timelib_sll number)
593592
{
594593
if (number >= 10 && number <= 19) {
595594
return "th";
@@ -1649,7 +1648,7 @@ static const zend_object_iterator_funcs date_period_it_funcs = {
16491648
NULL, /* get_gc */
16501649
};
16511650

1652-
zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
1651+
static zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */
16531652
{
16541653
date_period_it *iterator;
16551654

@@ -2011,7 +2010,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
20112010
}
20122011
}
20132012

2014-
void date_timezone_object_to_hash(php_timezone_obj *tzobj, HashTable *props)
2013+
static void date_timezone_object_to_hash(php_timezone_obj *tzobj, HashTable *props)
20152014
{
20162015
zval zv;
20172016

0 commit comments

Comments
 (0)