mirror of
https://github.com/php/php-src.git
synced 2024-09-25 11:57:26 +00:00
Merge branch 'PHP-5.6' into PHP-7.0
This commit is contained in:
commit
922f325c68
File diff suppressed because it is too large
Load Diff
@ -110,7 +110,7 @@ typedef unsigned char uchar;
|
||||
|
||||
#define RET(i) {s->cur = cursor; return i;}
|
||||
|
||||
#define timelib_string_free free
|
||||
#define timelib_string_free timelib_free
|
||||
|
||||
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
|
||||
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
|
||||
@ -322,7 +322,7 @@ uchar *fill(Scanner *s, uchar *cursor){
|
||||
s->lim -= cnt;
|
||||
}
|
||||
if((s->top - s->lim) < BSIZE){
|
||||
uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
|
||||
uchar *buf = (uchar*) timelib_malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
|
||||
memcpy(buf, s->tok, s->lim - s->tok);
|
||||
s->tok = buf;
|
||||
s->ptr = &buf[s->ptr - s->bot];
|
||||
@ -330,7 +330,7 @@ uchar *fill(Scanner *s, uchar *cursor){
|
||||
s->pos = &buf[s->pos - s->bot];
|
||||
s->lim = &buf[s->lim - s->bot];
|
||||
s->top = &s->lim[BSIZE];
|
||||
free(s->bot);
|
||||
timelib_free(s->bot);
|
||||
s->bot = buf;
|
||||
}
|
||||
if((cnt = read(s->fd, (char*) s->lim, BSIZE)) != BSIZE){
|
||||
@ -345,37 +345,37 @@ uchar *fill(Scanner *s, uchar *cursor){
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_pbf_warning(Scanner *s, char *error, char *sptr, char *cptr)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = cptr - sptr;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = *cptr;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_pbf_error(Scanner *s, char *error, char *sptr, char *cptr)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = cptr - sptr;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = *cptr;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
|
||||
@ -439,7 +439,7 @@ static timelib_sll timelib_meridian_with_check(char **ptr, timelib_sll h)
|
||||
|
||||
static char *timelib_string(Scanner *s)
|
||||
{
|
||||
char *tmp = calloc(1, s->cur - s->tok + 1);
|
||||
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
|
||||
memcpy(tmp, s->tok, s->cur - s->tok);
|
||||
|
||||
return tmp;
|
||||
@ -466,10 +466,10 @@ static timelib_sll timelib_get_nr_ex(char **ptr, int max_length, int *scanned_le
|
||||
if (scanned_length) {
|
||||
*scanned_length = end - begin;
|
||||
}
|
||||
str = calloc(1, end - begin + 1);
|
||||
str = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
tmp_nr = strtoll(str, NULL, 10);
|
||||
free(str);
|
||||
timelib_free(str);
|
||||
return tmp_nr;
|
||||
}
|
||||
|
||||
@ -506,13 +506,13 @@ static double timelib_get_frac_nr(char **ptr, int max_length)
|
||||
++len;
|
||||
}
|
||||
end = *ptr;
|
||||
str = calloc(1, end - begin + 1);
|
||||
str = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
if (str[0] == ':') {
|
||||
str[0] = '.';
|
||||
}
|
||||
tmp_nr = strtod(str, NULL);
|
||||
free(str);
|
||||
timelib_free(str);
|
||||
return tmp_nr;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
word = calloc(1, end - begin + 1);
|
||||
word = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
for (tp = timelib_reltext_lookup; tp->name; tp++) {
|
||||
@ -558,7 +558,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
|
||||
}
|
||||
}
|
||||
|
||||
free(word);
|
||||
timelib_free(word);
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ static timelib_long timelib_lookup_month(char **ptr)
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
word = calloc(1, end - begin + 1);
|
||||
word = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
for (tp = timelib_month_lookup; tp->name; tp++) {
|
||||
@ -590,7 +590,7 @@ static timelib_long timelib_lookup_month(char **ptr)
|
||||
}
|
||||
}
|
||||
|
||||
free(word);
|
||||
timelib_free(word);
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
word = calloc(1, end - begin + 1);
|
||||
word = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
for (tp = timelib_relunit_lookup; tp->name; tp++) {
|
||||
@ -638,7 +638,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
|
||||
}
|
||||
}
|
||||
|
||||
free(word);
|
||||
timelib_free(word);
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -723,7 +723,7 @@ static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, in
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
word = calloc(1, end - begin + 1);
|
||||
word = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(word, begin, end - begin);
|
||||
|
||||
if ((tp = abbr_search(word, -1, 0))) {
|
||||
@ -790,7 +790,7 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
|
||||
found++;
|
||||
}
|
||||
}
|
||||
free(tz_abbr);
|
||||
timelib_free(tz_abbr);
|
||||
*tz_not_found = (found == 0);
|
||||
retval = offset;
|
||||
}
|
||||
@ -803,10 +803,10 @@ timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_n
|
||||
#define timelib_split_free(arg) { \
|
||||
int i; \
|
||||
for (i = 0; i < arg.c; i++) { \
|
||||
free(arg.v[i]); \
|
||||
timelib_free(arg.v[i]); \
|
||||
} \
|
||||
if (arg.v) { \
|
||||
free(arg.v); \
|
||||
timelib_free(arg.v); \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -1734,7 +1734,7 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@ -1762,7 +1762,7 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
}
|
||||
e++;
|
||||
|
||||
in.str = malloc((e - s) + YYMAXFILL);
|
||||
in.str = timelib_malloc((e - s) + YYMAXFILL);
|
||||
memset(in.str, 0, (e - s) + YYMAXFILL);
|
||||
memcpy(in.str, s, (e - s));
|
||||
in.lim = in.str + (e - s) + YYMAXFILL;
|
||||
@ -1798,7 +1798,7 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
|
||||
add_warning(&in, "The parsed date was invalid");
|
||||
}
|
||||
|
||||
free(in.str);
|
||||
timelib_free(in.str);
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
@ -1849,7 +1849,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
|
||||
int allow_extra = 0;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@ -2192,14 +2192,14 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
|
||||
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
|
||||
|
||||
if (!parsed->tz_abbr) {
|
||||
parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
|
||||
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
|
||||
}
|
||||
if (!parsed->tz_info) {
|
||||
parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
|
||||
}
|
||||
if (parsed->zone_type == 0 && now->zone_type != 0) {
|
||||
parsed->zone_type = now->zone_type;
|
||||
/* parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
|
||||
/* parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
|
||||
parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
|
||||
*/ parsed->is_localtime = 1;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generated by re2c 0.13.5 on Tue Sep 22 08:27:59 2015 */
|
||||
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
||||
/* Generated by re2c 0.13.5 on Thu Aug 13 10:30:12 2015 */
|
||||
#line 1 "parse_iso_intervals.re"
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -77,7 +77,7 @@ typedef unsigned char uchar;
|
||||
|
||||
#define RET(i) {s->cur = cursor; return i;}
|
||||
|
||||
#define timelib_string_free free
|
||||
#define timelib_string_free timelib_free
|
||||
|
||||
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
|
||||
#define TIMELIB_DEINIT timelib_string_free(str)
|
||||
@ -113,24 +113,24 @@ typedef struct Scanner {
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static char *timelib_string(Scanner *s)
|
||||
{
|
||||
char *tmp = calloc(1, s->cur - s->tok + 1);
|
||||
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
|
||||
memcpy(tmp, s->tok, s->cur - s->tok);
|
||||
|
||||
return tmp;
|
||||
@ -154,10 +154,10 @@ static timelib_sll timelib_get_nr(char **ptr, int max_length)
|
||||
++len;
|
||||
}
|
||||
end = *ptr;
|
||||
str = calloc(1, end - begin + 1);
|
||||
str = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
tmp_nr = strtoll(str, NULL, 10);
|
||||
free(str);
|
||||
timelib_free(str);
|
||||
return tmp_nr;
|
||||
}
|
||||
|
||||
@ -234,10 +234,10 @@ static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int
|
||||
#define timelib_split_free(arg) { \
|
||||
int i; \
|
||||
for (i = 0; i < arg.c; i++) { \
|
||||
free(arg.v[i]); \
|
||||
timelib_free(arg.v[i]); \
|
||||
} \
|
||||
if (arg.v) { \
|
||||
free(arg.v); \
|
||||
timelib_free(arg.v); \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -254,11 +254,11 @@ static int scan(Scanner *s)
|
||||
std:
|
||||
s->tok = cursor;
|
||||
s->len = 0;
|
||||
#line 282 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 282 "parse_iso_intervals.re"
|
||||
|
||||
|
||||
|
||||
#line 262 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 262 "<stdout>"
|
||||
{
|
||||
YYCTYPE yych;
|
||||
unsigned int yyaccept = 0;
|
||||
@ -297,7 +297,6 @@ std:
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
YYDEBUG(0, *YYCURSOR);
|
||||
if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20);
|
||||
yych = *YYCURSOR;
|
||||
if (yych <= ',') {
|
||||
@ -322,35 +321,30 @@ std:
|
||||
if (yych != 'R') goto yy11;
|
||||
}
|
||||
}
|
||||
YYDEBUG(2, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((yych = *YYCURSOR) <= '/') goto yy3;
|
||||
if (yych <= '9') goto yy98;
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
#line 395 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 395 "parse_iso_intervals.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
}
|
||||
#line 337 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 334 "<stdout>"
|
||||
yy4:
|
||||
YYDEBUG(4, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy3;
|
||||
if (yych <= '9') goto yy59;
|
||||
goto yy3;
|
||||
yy5:
|
||||
YYDEBUG(5, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych <= '9') goto yy12;
|
||||
if (yych == 'T') goto yy14;
|
||||
yy6:
|
||||
YYDEBUG(6, *YYCURSOR);
|
||||
#line 322 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 322 "parse_iso_intervals.re"
|
||||
{
|
||||
timelib_sll nr;
|
||||
int in_time = 0;
|
||||
@ -391,32 +385,26 @@ yy6:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 395 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 389 "<stdout>"
|
||||
yy7:
|
||||
YYDEBUG(7, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(8, *YYCURSOR);
|
||||
#line 384 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 384 "parse_iso_intervals.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
#line 404 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 396 "<stdout>"
|
||||
yy9:
|
||||
YYDEBUG(9, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(10, *YYCURSOR);
|
||||
#line 389 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 389 "parse_iso_intervals.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
#line 414 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 404 "<stdout>"
|
||||
yy11:
|
||||
YYDEBUG(11, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
goto yy3;
|
||||
yy12:
|
||||
YYDEBUG(12, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@ -433,7 +421,6 @@ yy12:
|
||||
}
|
||||
}
|
||||
yy13:
|
||||
YYDEBUG(13, *YYCURSOR);
|
||||
YYCURSOR = YYMARKER;
|
||||
if (yyaccept <= 0) {
|
||||
goto yy3;
|
||||
@ -441,7 +428,6 @@ yy13:
|
||||
goto yy6;
|
||||
}
|
||||
yy14:
|
||||
YYDEBUG(14, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yybm[0+yych] & 128) {
|
||||
@ -449,11 +435,9 @@ yy14:
|
||||
}
|
||||
goto yy6;
|
||||
yy15:
|
||||
YYDEBUG(15, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(16, *YYCURSOR);
|
||||
if (yybm[0+yych] & 128) {
|
||||
goto yy15;
|
||||
}
|
||||
@ -465,28 +449,23 @@ yy15:
|
||||
if (yych != 'S') goto yy13;
|
||||
}
|
||||
yy17:
|
||||
YYDEBUG(17, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
goto yy6;
|
||||
yy18:
|
||||
YYDEBUG(18, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych <= '9') goto yy22;
|
||||
goto yy6;
|
||||
yy19:
|
||||
YYDEBUG(19, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
if (yych >= ':') goto yy6;
|
||||
yy20:
|
||||
YYDEBUG(20, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(21, *YYCURSOR);
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy20;
|
||||
@ -497,22 +476,18 @@ yy20:
|
||||
goto yy13;
|
||||
}
|
||||
yy22:
|
||||
YYDEBUG(22, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(23, *YYCURSOR);
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy22;
|
||||
if (yych == 'S') goto yy17;
|
||||
goto yy13;
|
||||
yy24:
|
||||
YYDEBUG(24, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy25:
|
||||
YYDEBUG(25, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@ -532,7 +507,6 @@ yy25:
|
||||
}
|
||||
}
|
||||
yy26:
|
||||
YYDEBUG(26, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@ -540,7 +514,6 @@ yy26:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy27:
|
||||
YYDEBUG(27, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@ -548,7 +521,6 @@ yy27:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy28:
|
||||
YYDEBUG(28, *YYCURSOR);
|
||||
yyaccept = 1;
|
||||
yych = *(YYMARKER = ++YYCURSOR);
|
||||
if (yych <= '/') goto yy6;
|
||||
@ -556,11 +528,9 @@ yy28:
|
||||
if (yych == 'T') goto yy14;
|
||||
goto yy6;
|
||||
yy29:
|
||||
YYDEBUG(29, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(30, *YYCURSOR);
|
||||
if (yych <= 'D') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy29;
|
||||
@ -576,11 +546,9 @@ yy29:
|
||||
}
|
||||
}
|
||||
yy31:
|
||||
YYDEBUG(31, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(32, *YYCURSOR);
|
||||
if (yych <= 'C') {
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy31;
|
||||
@ -591,17 +559,14 @@ yy31:
|
||||
goto yy13;
|
||||
}
|
||||
yy33:
|
||||
YYDEBUG(33, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(34, *YYCURSOR);
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy33;
|
||||
if (yych == 'D') goto yy24;
|
||||
goto yy13;
|
||||
yy35:
|
||||
YYDEBUG(35, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
@ -620,22 +585,18 @@ yy35:
|
||||
goto yy13;
|
||||
}
|
||||
}
|
||||
YYDEBUG(36, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy39;
|
||||
YYDEBUG(37, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy40;
|
||||
if (yych <= '1') goto yy41;
|
||||
goto yy13;
|
||||
yy38:
|
||||
YYDEBUG(38, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
|
||||
yych = *YYCURSOR;
|
||||
yy39:
|
||||
YYDEBUG(39, *YYCURSOR);
|
||||
if (yych <= 'L') {
|
||||
if (yych <= '9') {
|
||||
if (yych <= '/') goto yy13;
|
||||
@ -655,21 +616,17 @@ yy39:
|
||||
}
|
||||
}
|
||||
yy40:
|
||||
YYDEBUG(40, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy42;
|
||||
goto yy13;
|
||||
yy41:
|
||||
YYDEBUG(41, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '3') goto yy13;
|
||||
yy42:
|
||||
YYDEBUG(42, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy13;
|
||||
YYDEBUG(43, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy44;
|
||||
@ -677,70 +634,55 @@ yy42:
|
||||
if (yych <= '3') goto yy46;
|
||||
goto yy13;
|
||||
yy44:
|
||||
YYDEBUG(44, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy47;
|
||||
goto yy13;
|
||||
yy45:
|
||||
YYDEBUG(45, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy47;
|
||||
goto yy13;
|
||||
yy46:
|
||||
YYDEBUG(46, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy47:
|
||||
YYDEBUG(47, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(48, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy49;
|
||||
if (yych <= '2') goto yy50;
|
||||
goto yy13;
|
||||
yy49:
|
||||
YYDEBUG(49, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy51;
|
||||
goto yy13;
|
||||
yy50:
|
||||
YYDEBUG(50, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy51:
|
||||
YYDEBUG(51, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(52, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(53, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(54, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(55, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(56, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(57, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(58, *YYCURSOR);
|
||||
#line 364 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 364 "parse_iso_intervals.re"
|
||||
{
|
||||
DEBUG_OUTPUT("combinedrep");
|
||||
TIMELIB_INIT;
|
||||
@ -759,17 +701,14 @@ yy51:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 763 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 705 "<stdout>"
|
||||
yy59:
|
||||
YYDEBUG(59, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(60, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(61, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') {
|
||||
if (yych == '-') goto yy64;
|
||||
@ -780,40 +719,33 @@ yy59:
|
||||
goto yy13;
|
||||
}
|
||||
yy62:
|
||||
YYDEBUG(62, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy85;
|
||||
goto yy13;
|
||||
yy63:
|
||||
YYDEBUG(63, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '2') goto yy85;
|
||||
goto yy13;
|
||||
yy64:
|
||||
YYDEBUG(64, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy65;
|
||||
if (yych <= '1') goto yy66;
|
||||
goto yy13;
|
||||
yy65:
|
||||
YYDEBUG(65, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy67;
|
||||
goto yy13;
|
||||
yy66:
|
||||
YYDEBUG(66, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '3') goto yy13;
|
||||
yy67:
|
||||
YYDEBUG(67, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != '-') goto yy13;
|
||||
YYDEBUG(68, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy69;
|
||||
@ -821,74 +753,58 @@ yy67:
|
||||
if (yych <= '3') goto yy71;
|
||||
goto yy13;
|
||||
yy69:
|
||||
YYDEBUG(69, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy72;
|
||||
goto yy13;
|
||||
yy70:
|
||||
YYDEBUG(70, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy72;
|
||||
goto yy13;
|
||||
yy71:
|
||||
YYDEBUG(71, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy72:
|
||||
YYDEBUG(72, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(73, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy74;
|
||||
if (yych <= '2') goto yy75;
|
||||
goto yy13;
|
||||
yy74:
|
||||
YYDEBUG(74, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy76;
|
||||
goto yy13;
|
||||
yy75:
|
||||
YYDEBUG(75, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy76:
|
||||
YYDEBUG(76, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(77, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(78, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(79, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != ':') goto yy13;
|
||||
YYDEBUG(80, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(81, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(82, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'Z') goto yy13;
|
||||
yy83:
|
||||
YYDEBUG(83, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(84, *YYCURSOR);
|
||||
#line 298 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 298 "parse_iso_intervals.re"
|
||||
{
|
||||
timelib_time *current;
|
||||
|
||||
@ -911,9 +827,8 @@ yy83:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_ISO_DATE;
|
||||
}
|
||||
#line 915 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 831 "<stdout>"
|
||||
yy85:
|
||||
YYDEBUG(85, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '0') goto yy86;
|
||||
@ -921,75 +836,60 @@ yy85:
|
||||
if (yych <= '3') goto yy88;
|
||||
goto yy13;
|
||||
yy86:
|
||||
YYDEBUG(86, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '0') goto yy13;
|
||||
if (yych <= '9') goto yy89;
|
||||
goto yy13;
|
||||
yy87:
|
||||
YYDEBUG(87, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy89;
|
||||
goto yy13;
|
||||
yy88:
|
||||
YYDEBUG(88, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '2') goto yy13;
|
||||
yy89:
|
||||
YYDEBUG(89, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych != 'T') goto yy13;
|
||||
YYDEBUG(90, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '1') goto yy91;
|
||||
if (yych <= '2') goto yy92;
|
||||
goto yy13;
|
||||
yy91:
|
||||
YYDEBUG(91, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych <= '9') goto yy93;
|
||||
goto yy13;
|
||||
yy92:
|
||||
YYDEBUG(92, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '5') goto yy13;
|
||||
yy93:
|
||||
YYDEBUG(93, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(94, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(95, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= '6') goto yy13;
|
||||
YYDEBUG(96, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych <= '/') goto yy13;
|
||||
if (yych >= ':') goto yy13;
|
||||
YYDEBUG(97, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
if (yych == 'Z') goto yy83;
|
||||
goto yy13;
|
||||
yy98:
|
||||
YYDEBUG(98, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
YYDEBUG(99, *YYCURSOR);
|
||||
if (yych <= '/') goto yy100;
|
||||
if (yych <= '9') goto yy98;
|
||||
yy100:
|
||||
YYDEBUG(100, *YYCURSOR);
|
||||
#line 287 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 287 "parse_iso_intervals.re"
|
||||
{
|
||||
DEBUG_OUTPUT("recurrences");
|
||||
TIMELIB_INIT;
|
||||
@ -999,9 +899,9 @@ yy100:
|
||||
s->have_recurrences = 1;
|
||||
return TIMELIB_PERIOD;
|
||||
}
|
||||
#line 1003 "ext/date/lib/parse_iso_intervals.c"
|
||||
#line 903 "<stdout>"
|
||||
}
|
||||
#line 399 "ext/date/lib/parse_iso_intervals.re"
|
||||
#line 399 "parse_iso_intervals.re"
|
||||
|
||||
}
|
||||
#ifdef PHP_WIN32
|
||||
@ -1020,7 +920,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@ -1046,7 +946,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
e++;
|
||||
|
||||
/* init cursor */
|
||||
in.str = malloc((e - s) + YYMAXFILL);
|
||||
in.str = timelib_malloc((e - s) + YYMAXFILL);
|
||||
memset(in.str, 0, (e - s) + YYMAXFILL);
|
||||
memcpy(in.str, s, (e - s));
|
||||
in.lim = in.str + (e - s) + YYMAXFILL;
|
||||
@ -1100,7 +1000,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
#endif
|
||||
} while(t != EOI);
|
||||
|
||||
free(in.str);
|
||||
timelib_free(in.str);
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ typedef unsigned char uchar;
|
||||
|
||||
#define RET(i) {s->cur = cursor; return i;}
|
||||
|
||||
#define timelib_string_free free
|
||||
#define timelib_string_free timelib_free
|
||||
|
||||
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
|
||||
#define TIMELIB_DEINIT timelib_string_free(str)
|
||||
@ -111,24 +111,24 @@ typedef struct Scanner {
|
||||
static void add_warning(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->warning_count++;
|
||||
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages = timelib_realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
|
||||
s->errors->warning_messages[s->errors->warning_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static void add_error(Scanner *s, char *error)
|
||||
{
|
||||
s->errors->error_count++;
|
||||
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
|
||||
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
|
||||
s->errors->error_messages[s->errors->error_count - 1].message = timelib_strdup(error);
|
||||
}
|
||||
|
||||
static char *timelib_string(Scanner *s)
|
||||
{
|
||||
char *tmp = calloc(1, s->cur - s->tok + 1);
|
||||
char *tmp = timelib_calloc(1, s->cur - s->tok + 1);
|
||||
memcpy(tmp, s->tok, s->cur - s->tok);
|
||||
|
||||
return tmp;
|
||||
@ -152,10 +152,10 @@ static timelib_sll timelib_get_nr(char **ptr, int max_length)
|
||||
++len;
|
||||
}
|
||||
end = *ptr;
|
||||
str = calloc(1, end - begin + 1);
|
||||
str = timelib_calloc(1, end - begin + 1);
|
||||
memcpy(str, begin, end - begin);
|
||||
tmp_nr = strtoll(str, NULL, 10);
|
||||
free(str);
|
||||
timelib_free(str);
|
||||
return tmp_nr;
|
||||
}
|
||||
|
||||
@ -232,10 +232,10 @@ static timelib_long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int
|
||||
#define timelib_split_free(arg) { \
|
||||
int i; \
|
||||
for (i = 0; i < arg.c; i++) { \
|
||||
free(arg.v[i]); \
|
||||
timelib_free(arg.v[i]); \
|
||||
} \
|
||||
if (arg.v) { \
|
||||
free(arg.v); \
|
||||
timelib_free(arg.v); \
|
||||
} \
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
char *e = s + len - 1;
|
||||
|
||||
memset(&in, 0, sizeof(in));
|
||||
in.errors = malloc(sizeof(struct timelib_error_container));
|
||||
in.errors = timelib_malloc(sizeof(struct timelib_error_container));
|
||||
in.errors->warning_count = 0;
|
||||
in.errors->warning_messages = NULL;
|
||||
in.errors->error_count = 0;
|
||||
@ -440,7 +440,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
e++;
|
||||
|
||||
/* init cursor */
|
||||
in.str = malloc((e - s) + YYMAXFILL);
|
||||
in.str = timelib_malloc((e - s) + YYMAXFILL);
|
||||
memset(in.str, 0, (e - s) + YYMAXFILL);
|
||||
memcpy(in.str, s, (e - s));
|
||||
in.lim = in.str + (e - s) + YYMAXFILL;
|
||||
@ -494,7 +494,7 @@ void timelib_strtointerval(char *s, size_t len,
|
||||
#endif
|
||||
} while(t != EOI);
|
||||
|
||||
free(in.str);
|
||||
timelib_free(in.str);
|
||||
if (errors) {
|
||||
*errors = in.errors;
|
||||
} else {
|
||||
|
@ -107,7 +107,7 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
unsigned char *cbuffer = NULL;
|
||||
|
||||
if (tz->bit32.timecnt) {
|
||||
buffer = (int32_t*) malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
buffer = (int32_t*) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
@ -117,9 +117,9 @@ static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
buffer[i] = timelib_conv_int(buffer[i]);
|
||||
}
|
||||
|
||||
cbuffer = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
cbuffer = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
if (!cbuffer) {
|
||||
free(buffer);
|
||||
timelib_free(buffer);
|
||||
return;
|
||||
}
|
||||
memcpy(cbuffer, *tzf, sizeof(unsigned char) * tz->bit32.timecnt);
|
||||
@ -151,16 +151,16 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
int32_t *leap_buffer;
|
||||
unsigned int i, j;
|
||||
|
||||
buffer = (unsigned char*) malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.typecnt * sizeof(unsigned char) * 6);
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(buffer, *tzf, sizeof(unsigned char) * 6 * tz->bit32.typecnt);
|
||||
*tzf += sizeof(unsigned char) * 6 * tz->bit32.typecnt;
|
||||
|
||||
tz->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
tz->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
if (!tz->type) {
|
||||
free(buffer);
|
||||
timelib_free(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -170,9 +170,9 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
tz->type[i].isdst = buffer[j + 4];
|
||||
tz->type[i].abbr_idx = buffer[j + 5];
|
||||
}
|
||||
free(buffer);
|
||||
timelib_free(buffer);
|
||||
|
||||
tz->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
|
||||
tz->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
|
||||
if (!tz->timezone_abbr) {
|
||||
return;
|
||||
}
|
||||
@ -180,27 +180,27 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
*tzf += sizeof(char) * tz->bit32.charcnt;
|
||||
|
||||
if (tz->bit32.leapcnt) {
|
||||
leap_buffer = (int32_t *) malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
|
||||
leap_buffer = (int32_t *) timelib_malloc(tz->bit32.leapcnt * 2 * sizeof(int32_t));
|
||||
if (!leap_buffer) {
|
||||
return;
|
||||
}
|
||||
memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz->bit32.leapcnt * 2);
|
||||
*tzf += sizeof(int32_t) * tz->bit32.leapcnt * 2;
|
||||
|
||||
tz->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
tz->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
if (!tz->leap_times) {
|
||||
free(leap_buffer);
|
||||
timelib_free(leap_buffer);
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < tz->bit32.leapcnt; i++) {
|
||||
tz->leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]);
|
||||
tz->leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]);
|
||||
}
|
||||
free(leap_buffer);
|
||||
timelib_free(leap_buffer);
|
||||
}
|
||||
|
||||
if (tz->bit32.ttisstdcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisstdcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
@ -210,11 +210,11 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
for (i = 0; i < tz->bit32.ttisstdcnt; i++) {
|
||||
tz->type[i].isstdcnt = buffer[i];
|
||||
}
|
||||
free(buffer);
|
||||
timelib_free(buffer);
|
||||
}
|
||||
|
||||
if (tz->bit32.ttisgmtcnt) {
|
||||
buffer = (unsigned char*) malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
|
||||
buffer = (unsigned char*) timelib_malloc(tz->bit32.ttisgmtcnt * sizeof(unsigned char));
|
||||
if (!buffer) {
|
||||
return;
|
||||
}
|
||||
@ -224,7 +224,7 @@ static void read_types(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
for (i = 0; i < tz->bit32.ttisgmtcnt; i++) {
|
||||
tz->type[i].isgmtcnt = buffer[i];
|
||||
}
|
||||
free(buffer);
|
||||
timelib_free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ static void read_location(const unsigned char **tzf, timelib_tzinfo *tz)
|
||||
comments_len = timelib_conv_int(buffer[2]);
|
||||
*tzf += sizeof(buffer);
|
||||
|
||||
tz->location.comments = malloc(comments_len + 1);
|
||||
tz->location.comments = timelib_malloc(comments_len + 1);
|
||||
memcpy(tz->location.comments, *tzf, comments_len);
|
||||
tz->location.comments[comments_len] = '\0';
|
||||
*tzf += comments_len;
|
||||
@ -310,7 +310,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
|
||||
tmp = setlocale(LC_CTYPE, NULL);
|
||||
if (tmp) {
|
||||
cur_locale = strdup(tmp);
|
||||
cur_locale = timelib_strdup(tmp);
|
||||
}
|
||||
setlocale(LC_CTYPE, "C");
|
||||
#endif
|
||||
@ -327,7 +327,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
(*tzf) = &(tzdb->data[tzdb->index[mid].pos]);
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_CTYPE, cur_locale);
|
||||
if (cur_locale) free(cur_locale);
|
||||
if (cur_locale) timelib_free(cur_locale);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@ -336,7 +336,7 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_CTYPE, cur_locale);
|
||||
if (cur_locale) free(cur_locale);
|
||||
if (cur_locale) timelib_free(cur_locale);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -503,7 +503,7 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
|
||||
|
||||
tmp->offset = offset;
|
||||
tmp->leap_secs = leap_secs;
|
||||
tmp->abbr = abbr ? strdup(abbr) : strdup("GMT");
|
||||
tmp->abbr = abbr ? timelib_strdup(abbr) : timelib_strdup("GMT");
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define TIMELIB_TIME_FREE(m) \
|
||||
if (m) { \
|
||||
free(m); \
|
||||
timelib_free(m); \
|
||||
m = NULL; \
|
||||
} \
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
timelib_time* timelib_time_ctor(void)
|
||||
{
|
||||
timelib_time *t;
|
||||
t = calloc(1, sizeof(timelib_time));
|
||||
t = timelib_calloc(1, sizeof(timelib_time));
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -47,7 +47,7 @@ timelib_time* timelib_time_ctor(void)
|
||||
timelib_rel_time* timelib_rel_time_ctor(void)
|
||||
{
|
||||
timelib_rel_time *t;
|
||||
t = calloc(1, sizeof(timelib_rel_time));
|
||||
t = timelib_calloc(1, sizeof(timelib_rel_time));
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -57,7 +57,7 @@ timelib_time* timelib_time_clone(timelib_time *orig)
|
||||
timelib_time *tmp = timelib_time_ctor();
|
||||
memcpy(tmp, orig, sizeof(timelib_time));
|
||||
if (orig->tz_abbr) {
|
||||
tmp->tz_abbr = strdup(orig->tz_abbr);
|
||||
tmp->tz_abbr = timelib_strdup(orig->tz_abbr);
|
||||
}
|
||||
if (orig->tz_info) {
|
||||
tmp->tz_info = orig->tz_info;
|
||||
@ -78,7 +78,7 @@ void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
|
||||
size_t tz_abbr_len = strlen(tz_abbr);
|
||||
|
||||
TIMELIB_TIME_FREE(tm->tz_abbr);
|
||||
tm->tz_abbr = strdup(tz_abbr);
|
||||
tm->tz_abbr = timelib_strdup(tz_abbr);
|
||||
for (i = 0; i < tz_abbr_len; i++) {
|
||||
tm->tz_abbr[i] = toupper(tz_abbr[i]);
|
||||
}
|
||||
@ -98,7 +98,7 @@ void timelib_rel_time_dtor(timelib_rel_time* t)
|
||||
timelib_time_offset* timelib_time_offset_ctor(void)
|
||||
{
|
||||
timelib_time_offset *t;
|
||||
t = calloc(1, sizeof(timelib_time_offset));
|
||||
t = timelib_calloc(1, sizeof(timelib_time_offset));
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -112,8 +112,8 @@ void timelib_time_offset_dtor(timelib_time_offset* t)
|
||||
timelib_tzinfo* timelib_tzinfo_ctor(char *name)
|
||||
{
|
||||
timelib_tzinfo *t;
|
||||
t = calloc(1, sizeof(timelib_tzinfo));
|
||||
t->name = strdup(name);
|
||||
t = timelib_calloc(1, sizeof(timelib_tzinfo));
|
||||
t->name = timelib_strdup(name);
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -128,18 +128,18 @@ timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
|
||||
tmp->bit32.typecnt = tz->bit32.typecnt;
|
||||
tmp->bit32.charcnt = tz->bit32.charcnt;
|
||||
|
||||
tmp->trans = (int32_t *) malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
tmp->trans = (int32_t *) timelib_malloc(tz->bit32.timecnt * sizeof(int32_t));
|
||||
tmp->trans_idx = (unsigned char*) timelib_malloc(tz->bit32.timecnt * sizeof(unsigned char));
|
||||
memcpy(tmp->trans, tz->trans, tz->bit32.timecnt * sizeof(int32_t));
|
||||
memcpy(tmp->trans_idx, tz->trans_idx, tz->bit32.timecnt * sizeof(unsigned char));
|
||||
|
||||
tmp->type = (ttinfo*) malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
tmp->type = (ttinfo*) timelib_malloc(tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
memcpy(tmp->type, tz->type, tz->bit32.typecnt * sizeof(struct ttinfo));
|
||||
|
||||
tmp->timezone_abbr = (char*) malloc(tz->bit32.charcnt);
|
||||
tmp->timezone_abbr = (char*) timelib_malloc(tz->bit32.charcnt);
|
||||
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->bit32.charcnt);
|
||||
|
||||
tmp->leap_times = (tlinfo*) malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
tmp->leap_times = (tlinfo*) timelib_malloc(tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
memcpy(tmp->leap_times, tz->leap_times, tz->bit32.leapcnt * sizeof(tlinfo));
|
||||
|
||||
return tmp;
|
||||
@ -171,14 +171,14 @@ void timelib_error_container_dtor(timelib_error_container *errors)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < errors->warning_count; i++) {
|
||||
free(errors->warning_messages[i].message);
|
||||
timelib_free(errors->warning_messages[i].message);
|
||||
}
|
||||
free(errors->warning_messages);
|
||||
timelib_free(errors->warning_messages);
|
||||
for (i = 0; i < errors->error_count; i++) {
|
||||
free(errors->error_messages[i].message);
|
||||
timelib_free(errors->error_messages[i].message);
|
||||
}
|
||||
free(errors->error_messages);
|
||||
free(errors);
|
||||
timelib_free(errors->error_messages);
|
||||
timelib_free(errors);
|
||||
}
|
||||
|
||||
timelib_long timelib_date_to_int(timelib_time *d, int *error)
|
||||
|
@ -30,8 +30,16 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201501
|
||||
#define TIMELIB_ASCII_VERSION "2015.01"
|
||||
#ifndef timelib_malloc
|
||||
# define timelib_malloc malloc
|
||||
# define timelib_realloc realloc
|
||||
# define timelib_calloc calloc
|
||||
# define timelib_strdup strdup
|
||||
# define timelib_free free
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201502
|
||||
#define TIMELIB_ASCII_VERSION "2015.02"
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
|
@ -427,9 +427,9 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
|
||||
|
||||
tz->dst = gmt_offset->is_dst;
|
||||
if (tz->tz_abbr) {
|
||||
free(tz->tz_abbr);
|
||||
timelib_free(tz->tz_abbr);
|
||||
}
|
||||
tz->tz_abbr = strdup(gmt_offset->abbr);
|
||||
tz->tz_abbr = timelib_strdup(gmt_offset->abbr);
|
||||
timelib_time_offset_dtor(gmt_offset);
|
||||
}
|
||||
return tmp;
|
||||
|
@ -221,7 +221,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
|
||||
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
timelib_free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = NULL;
|
||||
|
||||
@ -235,9 +235,9 @@ void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
|
||||
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
|
||||
{
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
timelib_free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = strdup(abbr_info.abbr);
|
||||
t->tz_abbr = timelib_strdup(abbr_info.abbr);
|
||||
|
||||
t->z = abbr_info.utc_offset;
|
||||
t->have_zone = 1;
|
||||
@ -261,9 +261,9 @@ void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
|
||||
t->dst = gmt_offset->is_dst;
|
||||
t->tz_info = tz;
|
||||
if (t->tz_abbr) {
|
||||
free(t->tz_abbr);
|
||||
timelib_free(t->tz_abbr);
|
||||
}
|
||||
t->tz_abbr = strdup(gmt_offset->abbr);
|
||||
t->tz_abbr = timelib_strdup(gmt_offset->abbr);
|
||||
timelib_time_offset_dtor(gmt_offset);
|
||||
|
||||
t->have_zone = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user