nlopess Tue Jun 27 19:48:02 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/date php_date.c
/php-src/ext/date/lib dow.c parse_tz.c timezonedb.h
Log:
add a couple of static and const keywords, to let the compiler optimize better
will MFB in a hour, or so
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.12&r2=1.43.2.45.2.13&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.12
php-src/ext/date/php_date.c:1.43.2.45.2.13
--- php-src/ext/date/php_date.c:1.43.2.45.2.12 Fri Jun 23 13:53:43 2006
+++ php-src/ext/date/php_date.c Tue Jun 27 19:48:01 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.43.2.45.2.12 2006/06/23 13:53:43 tony2001 Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.13 2006/06/27 19:48:01 nlopess Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -230,8 +230,8 @@
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 @@
/* {{{ 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 @@
/* }}} */
/* {{{ 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) {
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/dow.c?r1=1.8.2.3&r2=1.8.2.3.2.1&diff_format=u
Index: php-src/ext/date/lib/dow.c
diff -u php-src/ext/date/lib/dow.c:1.8.2.3
php-src/ext/date/lib/dow.c:1.8.2.3.2.1
--- php-src/ext/date/lib/dow.c:1.8.2.3 Sun Jan 1 12:50:01 2006
+++ php-src/ext/date/lib/dow.c Tue Jun 27 19:48:01 2006
@@ -16,12 +16,12 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dow.c,v 1.8.2.3 2006/01/01 12:50:01 sniper Exp $ */
+/* $Id: dow.c,v 1.8.2.3.2.1 2006/06/27 19:48:01 nlopess Exp $ */
#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 @@
}
/* 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)
{
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.20.2.6.2.1&r2=1.20.2.6.2.2&diff_format=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.1
php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.2
--- php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.1 Sun May 14 17:36:04 2006
+++ php-src/ext/date/lib/parse_tz.c Tue Jun 27 19:48:01 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_tz.c,v 1.20.2.6.2.1 2006/05/14 17:36:04 derick Exp $ */
+/* $Id: parse_tz.c,v 1.20.2.6.2.2 2006/06/27 19:48:01 nlopess Exp $ */
#include "timelib.h"
@@ -240,8 +240,8 @@
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 @@
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);
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timezonedb.h?r1=1.4.2.7.2.1&r2=1.4.2.7.2.2&diff_format=u
Index: php-src/ext/date/lib/timezonedb.h
diff -u php-src/ext/date/lib/timezonedb.h:1.4.2.7.2.1
php-src/ext/date/lib/timezonedb.h:1.4.2.7.2.2
--- php-src/ext/date/lib/timezonedb.h:1.4.2.7.2.1 Sun May 14 17:36:04 2006
+++ php-src/ext/date/lib/timezonedb.h Tue Jun 27 19:48:01 2006
@@ -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 @@
{ "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 @@
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 };
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php