summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2006-06-27 19:48:01 +0000
committerNuno Lopes <nlopess@php.net>2006-06-27 19:48:01 +0000
commit5c97837ca201bd9b8d8f8cd4f84685f097b933cc (patch)
tree39b5a8669bd0bec53dea5ee310ae97f69ea0b897 /ext
parent7dec2a73540771eb548389b94b4d70ad19ffd54e (diff)
downloadphp-git-5c97837ca201bd9b8d8f8cd4f84685f097b933cc.tar.gz
add a couple of static and const keywords, to let the compiler optimize better
will MFB in a hour, or so
Diffstat (limited to 'ext')
-rw-r--r--ext/date/lib/dow.c12
-rw-r--r--ext/date/lib/parse_tz.c6
-rw-r--r--ext/date/lib/timezonedb.h6
-rw-r--r--ext/date/php_date.c20
4 files changed, 22 insertions, 22 deletions
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index af0353fdbf..ca66313a55 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -20,8 +20,8 @@
#include "timelib.h"
-static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
-static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
+static const int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
+static const int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
static timelib_sll century_value(timelib_sll j)
{
@@ -62,10 +62,10 @@ timelib_sll timelib_iso_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d)
}
/* jan feb mar apr may jun jul aug sep oct nov dec */
-static int d_table_common[13] = { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
-static int d_table_leap[13] = { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
-static int ml_table_common[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-static int ml_table_leap[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static const int d_table_common[13] = { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+static const int d_table_leap[13] = { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 };
+static const int ml_table_common[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static const int ml_table_leap[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
timelib_sll timelib_day_of_year(timelib_sll y, timelib_sll m, timelib_sll d)
{
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index d4e6014b17..46ddb9786d 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -240,8 +240,8 @@ const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *c
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
{
- unsigned char *tzf;
- return (seek_to_tz_position((unsigned char**) &tzf, timezone, tzdb));
+ const unsigned char *tzf;
+ return (seek_to_tz_position(&tzf, timezone, tzdb));
}
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
@@ -249,7 +249,7 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
const unsigned char *tzf;
timelib_tzinfo *tmp;
- if (seek_to_tz_position((unsigned char**) &tzf, timezone, tzdb)) {
+ if (seek_to_tz_position(&tzf, timezone, tzdb)) {
tmp = timelib_tzinfo_ctor(timezone);
read_header((char**) &tzf, tmp);
diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h
index ce06e9ea13..4dbe789ed9 100644
--- a/ext/date/lib/timezonedb.h
+++ b/ext/date/lib/timezonedb.h
@@ -1,4 +1,4 @@
-const timelib_tzdb_index_entry timezonedb_idx_builtin[538] = {
+static const timelib_tzdb_index_entry timezonedb_idx_builtin[538] = {
{ "Africa/Abidjan" , 0x000000 },
{ "Africa/Accra" , 0x000049 },
{ "Africa/Addis_Ababa" , 0x0000E5 },
@@ -539,7 +539,7 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[538] = {
{ "Zulu" , 0x03904E },
};
/* This is a generated file, do not modify */
-const unsigned char timelib_timezone_db_data_builtin[233606] = {
+static const unsigned char timelib_timezone_db_data_builtin[233606] = {
/* Africa/Abidjan */
@@ -16492,4 +16492,4 @@ const unsigned char timelib_timezone_db_data_builtin[233606] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, };
-const timelib_tzdb timezonedb_builtin = { "2006.1", 538, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+static const timelib_tzdb timezonedb_builtin = { "2006.1", 538, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 1184a10bc6..39074111d9 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -230,8 +230,8 @@ ZEND_DECLARE_MODULE_GLOBALS(date)
static PHP_GINIT_FUNCTION(date);
/* True global */
-timelib_tzdb *php_date_global_timezone_db;
-int php_date_global_timezone_db_enabled;
+static timelib_tzdb *php_date_global_timezone_db;
+static int php_date_global_timezone_db_enabled;
#define DATE_DEFAULT_LATITUDE "31.7667"
#define DATE_DEFAULT_LONGITUDE "35.2333"
@@ -637,25 +637,25 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D)
/* {{{ date() and gmdate() data */
#include "ext/standard/php_smart_str.h"
-static char *mon_full_names[] = {
+static const char *mon_full_names[] = {
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
};
-static char *mon_short_names[] = {
+static const char *mon_short_names[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-static char *day_full_names[] = {
+static const char *day_full_names[] = {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
};
-static char *day_short_names[] = {
+static const char *day_short_names[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
-static char *english_suffix(timelib_sll number)
+static const char *english_suffix(timelib_sll number)
{
if (number >= 10 && number <= 19) {
return "th";
@@ -671,16 +671,16 @@ static char *english_suffix(timelib_sll number)
/* }}} */
/* {{{ day of week helpers */
-char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
+static const char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
{
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
if (day_of_week < 0) {
return "Unknown";
}
- return day_full_names[day_of_week];
+ return day_full_names[day_of_week];
}
-char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
+static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
{
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
if (day_of_week < 0) {