Commit:    58a8013e5ff8174aeac4cb38c50c435de9ea5622
Author:    Lonny Kapelushnik <lon...@gmail.com>         Mon, 14 Jan 2013 
23:03:52 +0000
Committer: Derick Rethans <git...@derickrethans.nl>      Sun, 31 Mar 2013 
10:45:01 +0100
Parents:   a4ca01cc2bc18204ad09ac4cc0f886539f8911e0
Branches:  PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=58a8013e5ff8174aeac4cb38c50c435de9ea5622

Log:
Rebased to PHP-5.4
Implemented Dmitrys change from df97c3aa0d331be668bd5d8f27fff96d4e3ac1d7
Moved the timelib_parse_tz_cor function to ext/date/lib/timelib.c

Changed paths:
  M  ext/date/lib/parse_date.re
  M  ext/date/lib/parse_iso_intervals.re
  M  ext/date/lib/timelib.c
  M  ext/date/lib/timelib.h
  M  ext/date/php_date.c


Diff:
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 06ab7e3..f3f5906 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -168,8 +168,6 @@ typedef struct _timelib_relunit {
        int         multiplier;
 } timelib_relunit;
 
-#define HOUR(a) (int)(a * 60)
-
 /* The timezone table. */
 const static timelib_tz_lookup_table timelib_timezone_lookup[] = {
 #include "timezonemap.h"
@@ -2238,39 +2236,6 @@ const timelib_tz_lookup_table 
*timelib_timezone_abbreviations_list(void)
        return timelib_timezone_lookup;
 }
 
-long timelib_parse_tz_cor(char **ptr)
-{
-       char *begin = *ptr, *end;
-       long  tmp;
-
-       while (isdigit(**ptr) || **ptr == ':') {
-               ++*ptr;
-       }
-       end = *ptr;
-       switch (end - begin) {
-               case 1:
-               case 2:
-                       return HOUR(strtol(begin, NULL, 10));
-                       break;
-               case 3:
-               case 4:
-                       if (begin[1] == ':') {
-                               tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 2, NULL, 10);
-                               return tmp;
-                       } else if (begin[2] == ':') {
-                               tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 3, NULL, 10);
-                               return tmp;
-                       } else {
-                               tmp = strtol(begin, NULL, 10);
-                               return HOUR(tmp / 100) + tmp % 100;
-                       }
-               case 5:
-                       tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, 
NULL, 10);
-                       return tmp;
-       }
-       return 0;
-}
-
 #ifdef DEBUG_PARSER_STUB
 int main(void)
 {
diff --git a/ext/date/lib/parse_iso_intervals.re 
b/ext/date/lib/parse_iso_intervals.re
index 56aa34d..e50ab37 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -102,8 +102,6 @@ typedef struct Scanner {
        int have_end_date;
 } Scanner;
 
-#define HOUR(a) (int)(a * 60)
-
 static void add_warning(Scanner *s, char *error)
 {
        s->errors->warning_count++;
@@ -176,39 +174,6 @@ static timelib_ull timelib_get_unsigned_nr(char **ptr, int 
max_length)
        return dir * timelib_get_nr(ptr, max_length);
 }
 
-static long timelib_parse_tz_cor(char **ptr)
-{
-       char *begin = *ptr, *end;
-       long  tmp;
-
-       while (isdigit(**ptr) || **ptr == ':') {
-               ++*ptr;
-       }
-       end = *ptr;
-       switch (end - begin) {
-               case 1:
-               case 2:
-                       return HOUR(strtol(begin, NULL, 10));
-                       break;
-               case 3:
-               case 4:
-                       if (begin[1] == ':') {
-                               tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 2, NULL, 10);
-                               return tmp;
-                       } else if (begin[2] == ':') {
-                               tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 3, NULL, 10);
-                               return tmp;
-                       } else {
-                               tmp = strtol(begin, NULL, 10);
-                               return HOUR(tmp / 100) + tmp % 100;
-                       }
-               case 5:
-                       tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, 
NULL, 10);
-                       return tmp;
-       }
-       return 0;
-}
-
 static void timelib_eat_spaces(char **ptr)
 {
        while (**ptr == ' ' || **ptr == '\t') {
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index 2f457a9..84354e3 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -30,6 +30,8 @@
 
 #define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)
 
+#define HOUR(a) (int)(a * 60)
+
 timelib_time* timelib_time_ctor(void)
 {
        timelib_time *t;
@@ -284,3 +286,35 @@ void timelib_dump_rel_time(timelib_rel_time *d)
        printf("\n");
 }
 
+long timelib_parse_tz_cor(char **ptr)
+{
+        char *begin = *ptr, *end;
+        long  tmp;
+
+        while (isdigit(**ptr) || **ptr == ':') {
+                ++*ptr;
+        }
+        end = *ptr;
+        switch (end - begin) {
+                case 1:
+                case 2:
+                        return HOUR(strtol(begin, NULL, 10));
+                        break;
+                case 3:
+                case 4:
+                        if (begin[1] == ':') {
+                                tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 2, NULL, 10);
+                                return tmp;
+                        } else if (begin[2] == ':') {
+                                tmp = HOUR(strtol(begin, NULL, 10)) + 
strtol(begin + 3, NULL, 10);
+                                return tmp;
+                        } else {
+                                tmp = strtol(begin, NULL, 10);
+                                return HOUR(tmp / 100) + tmp % 100;
+                        }
+                case 5:
+                        tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 
3, NULL, 10);
+                        return tmp;
+        }
+        return 0;
+}
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index d941cf6..dfb7dc0 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -130,6 +130,7 @@ void timelib_dump_date(timelib_time *d, int options);
 void timelib_dump_rel_time(timelib_rel_time *d);
 
 void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
+long timelib_parse_tz_cor(char **ptr);
 
 /* from astro.c */
 double timelib_ts_to_juliandate(timelib_sll ts);
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index eff82f6..0367726 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -633,6 +633,7 @@ static HashTable *date_object_get_properties_interval(zval 
*object TSRMLS_DC);
 static HashTable *date_object_get_gc_period(zval *object, zval ***table, int 
*n TSRMLS_DC);
 static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC);
 static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC);
+static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int 
*n TSRMLS_DC);
 
 zval *date_interval_read_property(zval *object, zval *member, int type, const 
zend_literal *key TSRMLS_DC);
 void date_interval_write_property(zval *object, zval *member, zval *value, 
const zend_literal *key TSRMLS_DC);
@@ -2021,6 +2022,7 @@ static void date_register_classes(TSRMLS_D)
        memcpy(&date_object_handlers_timezone, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
        date_object_handlers_timezone.clone_obj = date_object_clone_timezone;
        date_object_handlers_timezone.get_properties = 
date_object_get_properties_timezone;
+       date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
 
 #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \
        zend_declare_class_constant_long(date_ce_timezone, const_name, 
sizeof(const_name)-1, value TSRMLS_CC);
@@ -2165,6 +2167,14 @@ static HashTable *date_object_get_gc(zval *object, zval 
***table, int *n TSRMLS_
        return zend_std_get_properties(object TSRMLS_CC);
 }
 
+static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int 
*n TSRMLS_DC)
+{
+
+       *table = NULL;
+       *n = 0;
+       return zend_std_get_properties(object TSRMLS_CC);
+}
+
 static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
 {
        HashTable *props;
@@ -2284,7 +2294,7 @@ static HashTable 
*date_object_get_properties_timezone(zval *object TSRMLS_DC)
 
        props = zend_std_get_properties(object TSRMLS_CC);
 
-       if (!tzobj->initialized || GC_G(gc_active)) {
+       if (!tzobj->initialized) {
                return props;
        }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to