diff options
Diffstat (limited to 'ext/date/lib/parse_date.c')
| -rw-r--r-- | ext/date/lib/parse_date.c | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 0230e45ca8..2907d2c745 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,5 +1,5 @@ -/* Generated by re2c 0.13.5 on Tue Sep 22 08:27:53 2015 */ -#line 1 "ext/date/lib/parse_date.re" +/* Generated by re2c 0.13.5 on Thu Aug 13 10:30:11 2015 */ +#line 1 "parse_date.re" /* * The MIT License (MIT) * @@ -112,7 +112,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; } @@ -324,7 +324,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]; @@ -332,7 +332,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){ @@ -347,37 +347,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) @@ -441,7 +441,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; @@ -468,10 +468,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; } @@ -508,13 +508,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; } @@ -550,7 +550,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++) { @@ -560,7 +560,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior) } } - free(word); + timelib_free(word); return value; } @@ -583,7 +583,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++) { @@ -592,7 +592,7 @@ static timelib_long timelib_lookup_month(char **ptr) } } - free(word); + timelib_free(word); return value; } @@ -630,7 +630,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++) { @@ -640,7 +640,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr) } } - free(word); + timelib_free(word); return value; } @@ -725,7 +725,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))) { @@ -792,7 +792,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; } @@ -805,10 +805,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); \ } \ } @@ -820,11 +820,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) std: s->tok = cursor; s->len = 0; -#line 946 "ext/date/lib/parse_date.re" +#line 946 "parse_date.re" -#line 828 "ext/date/lib/parse_date.c" +#line 828 "<stdout>" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -964,7 +964,7 @@ yy2: } yy3: YYDEBUG(3, *YYCURSOR); -#line 1626 "ext/date/lib/parse_date.re" +#line 1626 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -977,7 +977,7 @@ yy3: TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 981 "ext/date/lib/parse_date.c" +#line 981 "<stdout>" yy4: YYDEBUG(4, *YYCURSOR); yych = *++YYCURSOR; @@ -1288,12 +1288,12 @@ yy11: if (yych <= '9') goto yy1385; yy12: YYDEBUG(12, *YYCURSOR); -#line 1721 "ext/date/lib/parse_date.re" +#line 1721 "parse_date.re" { add_error(s, "Unexpected character"); goto std; } -#line 1297 "ext/date/lib/parse_date.c" +#line 1297 "<stdout>" yy13: YYDEBUG(13, *YYCURSOR); yych = *++YYCURSOR; @@ -2350,11 +2350,11 @@ yy48: if (yych <= '9') goto yy54; yy49: YYDEBUG(49, *YYCURSOR); -#line 1710 "ext/date/lib/parse_date.re" +#line 1710 "parse_date.re" { goto std; } -#line 2358 "ext/date/lib/parse_date.c" +#line 2358 "<stdout>" yy50: YYDEBUG(50, *YYCURSOR); yych = *++YYCURSOR; @@ -2363,12 +2363,12 @@ yy51: YYDEBUG(51, *YYCURSOR); ++YYCURSOR; YYDEBUG(52, *YYCURSOR); -#line 1715 "ext/date/lib/parse_date.re" +#line 1715 "parse_date.re" { s->pos = cursor; s->line++; goto std; } -#line 2372 "ext/date/lib/parse_date.c" +#line 2372 "<stdout>" yy53: YYDEBUG(53, *YYCURSOR); yych = *++YYCURSOR; @@ -2755,7 +2755,7 @@ yy71: if (yych == 's') goto yy73; yy72: YYDEBUG(72, *YYCURSOR); -#line 1694 "ext/date/lib/parse_date.re" +#line 1694 "parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -2770,7 +2770,7 @@ yy72: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2774 "ext/date/lib/parse_date.c" +#line 2774 "<stdout>" yy73: YYDEBUG(73, *YYCURSOR); yych = *++YYCURSOR; @@ -3532,7 +3532,7 @@ yy165: } yy166: YYDEBUG(166, *YYCURSOR); -#line 1557 "ext/date/lib/parse_date.re" +#line 1557 "parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -3549,7 +3549,7 @@ yy166: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3553 "ext/date/lib/parse_date.c" +#line 3553 "<stdout>" yy167: YYDEBUG(167, *YYCURSOR); yych = *++YYCURSOR; @@ -4069,7 +4069,7 @@ yy192: } yy193: YYDEBUG(193, *YYCURSOR); -#line 1616 "ext/date/lib/parse_date.re" +#line 1616 "parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4078,7 +4078,7 @@ yy193: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4082 "ext/date/lib/parse_date.c" +#line 4082 "<stdout>" yy194: YYDEBUG(194, *YYCURSOR); ++YYCURSOR; @@ -4129,7 +4129,7 @@ yy197: } yy198: YYDEBUG(198, *YYCURSOR); -#line 1362 "ext/date/lib/parse_date.re" +#line 1362 "parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -4142,7 +4142,7 @@ yy198: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4146 "ext/date/lib/parse_date.c" +#line 4146 "<stdout>" yy199: YYDEBUG(199, *YYCURSOR); yyaccept = 6; @@ -4411,7 +4411,7 @@ yy221: } yy222: YYDEBUG(222, *YYCURSOR); -#line 1664 "ext/date/lib/parse_date.re" +#line 1664 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -4440,7 +4440,7 @@ yy222: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4444 "ext/date/lib/parse_date.c" +#line 4444 "<stdout>" yy223: YYDEBUG(223, *YYCURSOR); yyaccept = 7; @@ -5138,7 +5138,7 @@ yy277: YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYDEBUG(278, *YYCURSOR); -#line 1640 "ext/date/lib/parse_date.re" +#line 1640 "parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -5161,7 +5161,7 @@ yy277: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5165 "ext/date/lib/parse_date.c" +#line 5165 "<stdout>" yy279: YYDEBUG(279, *YYCURSOR); yych = *++YYCURSOR; @@ -5339,7 +5339,7 @@ yy293: ++YYCURSOR; yy294: YYDEBUG(294, *YYCURSOR); -#line 1334 "ext/date/lib/parse_date.re" +#line 1334 "parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -5352,7 +5352,7 @@ yy294: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5356 "ext/date/lib/parse_date.c" +#line 5356 "<stdout>" yy295: YYDEBUG(295, *YYCURSOR); yych = *++YYCURSOR; @@ -6572,7 +6572,7 @@ yy361: if (yych <= '9') goto yy364; yy363: YYDEBUG(363, *YYCURSOR); -#line 1478 "ext/date/lib/parse_date.re" +#line 1478 "parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6585,7 +6585,7 @@ yy363: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6589 "ext/date/lib/parse_date.c" +#line 6589 "<stdout>" yy364: YYDEBUG(364, *YYCURSOR); yych = *++YYCURSOR; @@ -7223,7 +7223,7 @@ yy391: } yy392: YYDEBUG(392, *YYCURSOR); -#line 1536 "ext/date/lib/parse_date.re" +#line 1536 "parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -7243,7 +7243,7 @@ yy392: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7247 "ext/date/lib/parse_date.c" +#line 7247 "<stdout>" yy393: YYDEBUG(393, *YYCURSOR); yyaccept = 5; @@ -8993,7 +8993,7 @@ yy453: ++YYCURSOR; yy454: YYDEBUG(454, *YYCURSOR); -#line 1239 "ext/date/lib/parse_date.re" +#line 1239 "parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -9004,7 +9004,7 @@ yy454: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 9008 "ext/date/lib/parse_date.c" +#line 9008 "<stdout>" yy455: YYDEBUG(455, *YYCURSOR); yyaccept = 0; @@ -9564,7 +9564,7 @@ yy474: } yy475: YYDEBUG(475, *YYCURSOR); -#line 1376 "ext/date/lib/parse_date.re" +#line 1376 "parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9575,7 +9575,7 @@ yy475: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9579 "ext/date/lib/parse_date.c" +#line 9579 "<stdout>" yy476: YYDEBUG(476, *YYCURSOR); yyaccept = 10; @@ -9716,7 +9716,7 @@ yy487: YYDEBUG(487, *YYCURSOR); ++YYCURSOR; YYDEBUG(488, *YYCURSOR); -#line 1094 "ext/date/lib/parse_date.re" +#line 1094 "parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9732,7 +9732,7 @@ yy487: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9736 "ext/date/lib/parse_date.c" +#line 9736 "<stdout>" yy489: YYDEBUG(489, *YYCURSOR); yyaccept = 11; @@ -9745,7 +9745,7 @@ yy489: } yy490: YYDEBUG(490, *YYCURSOR); -#line 1131 "ext/date/lib/parse_date.re" +#line 1131 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long"); @@ -9770,7 +9770,7 @@ yy490: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9774 "ext/date/lib/parse_date.c" +#line 9774 "<stdout>" yy491: YYDEBUG(491, *YYCURSOR); yyaccept = 11; @@ -10080,7 +10080,7 @@ yy522: YYDEBUG(522, *YYCURSOR); ++YYCURSOR; YYDEBUG(523, *YYCURSOR); -#line 1111 "ext/date/lib/parse_date.re" +#line 1111 "parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10099,7 +10099,7 @@ yy522: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 10103 "ext/date/lib/parse_date.c" +#line 10103 "<stdout>" yy524: YYDEBUG(524, *YYCURSOR); yyaccept = 11; @@ -10205,7 +10205,7 @@ yy533: if (yych <= '9') goto yy540; yy534: YYDEBUG(534, *YYCURSOR); -#line 1293 "ext/date/lib/parse_date.re" +#line 1293 "parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -10219,7 +10219,7 @@ yy534: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 10223 "ext/date/lib/parse_date.c" +#line 10223 "<stdout>" yy535: YYDEBUG(535, *YYCURSOR); yych = *++YYCURSOR; @@ -10956,7 +10956,7 @@ yy604: YYDEBUG(605, *YYCURSOR); ++YYCURSOR; YYDEBUG(606, *YYCURSOR); -#line 1308 "ext/date/lib/parse_date.re" +#line 1308 "parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -10967,7 +10967,7 @@ yy604: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 10971 "ext/date/lib/parse_date.c" +#line 10971 "<stdout>" yy607: YYDEBUG(607, *YYCURSOR); yyaccept = 11; @@ -11003,7 +11003,7 @@ yy610: if (yych <= '9') goto yy604; yy611: YYDEBUG(611, *YYCURSOR); -#line 1320 "ext/date/lib/parse_date.re" +#line 1320 "parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11016,7 +11016,7 @@ yy611: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11020 "ext/date/lib/parse_date.c" +#line 11020 "<stdout>" yy612: YYDEBUG(612, *YYCURSOR); yyaccept = 11; @@ -11657,7 +11657,7 @@ yy655: } yy656: YYDEBUG(656, *YYCURSOR); -#line 1279 "ext/date/lib/parse_date.re" +#line 1279 "parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11670,7 +11670,7 @@ yy656: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11674 "ext/date/lib/parse_date.c" +#line 11674 "<stdout>" yy657: YYDEBUG(657, *YYCURSOR); yyaccept = 13; @@ -11776,7 +11776,7 @@ yy665: } yy666: YYDEBUG(666, *YYCURSOR); -#line 1223 "ext/date/lib/parse_date.re" +#line 1223 "parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -11791,7 +11791,7 @@ yy666: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11795 "ext/date/lib/parse_date.c" +#line 11795 "<stdout>" yy667: YYDEBUG(667, *YYCURSOR); yyaccept = 14; @@ -12024,7 +12024,7 @@ yy699: if (yych <= ':') goto yy703; yy700: YYDEBUG(700, *YYCURSOR); -#line 1506 "ext/date/lib/parse_date.re" +#line 1506 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12044,7 +12044,7 @@ yy700: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12048 "ext/date/lib/parse_date.c" +#line 12048 "<stdout>" yy701: YYDEBUG(701, *YYCURSOR); yych = *++YYCURSOR; @@ -12596,7 +12596,7 @@ yy762: } yy763: YYDEBUG(763, *YYCURSOR); -#line 1251 "ext/date/lib/parse_date.re" +#line 1251 "parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12609,7 +12609,7 @@ yy763: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12613 "ext/date/lib/parse_date.c" +#line 12613 "<stdout>" yy764: YYDEBUG(764, *YYCURSOR); yych = *++YYCURSOR; @@ -12648,7 +12648,7 @@ yy770: YYDEBUG(770, *YYCURSOR); ++YYCURSOR; YYDEBUG(771, *YYCURSOR); -#line 1492 "ext/date/lib/parse_date.re" +#line 1492 "parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12661,7 +12661,7 @@ yy770: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 12665 "ext/date/lib/parse_date.c" +#line 12665 "<stdout>" yy772: YYDEBUG(772, *YYCURSOR); yych = *++YYCURSOR; @@ -12799,7 +12799,7 @@ yy782: } yy783: YYDEBUG(783, *YYCURSOR); -#line 1527 "ext/date/lib/parse_date.re" +#line 1527 "parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -12807,7 +12807,7 @@ yy783: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12811 "ext/date/lib/parse_date.c" +#line 12811 "<stdout>" yy784: YYDEBUG(784, *YYCURSOR); yych = *++YYCURSOR; @@ -12958,7 +12958,7 @@ yy792: } yy793: YYDEBUG(793, *YYCURSOR); -#line 1348 "ext/date/lib/parse_date.re" +#line 1348 "parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -12971,7 +12971,7 @@ yy793: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 12975 "ext/date/lib/parse_date.c" +#line 12975 "<stdout>" yy794: YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; @@ -13186,7 +13186,7 @@ yy813: if (yych <= '7') goto yy816; yy814: YYDEBUG(814, *YYCURSOR); -#line 1459 "ext/date/lib/parse_date.re" +#line 1459 "parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); @@ -13204,7 +13204,7 @@ yy814: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13208 "ext/date/lib/parse_date.c" +#line 13208 "<stdout>" yy815: YYDEBUG(815, *YYCURSOR); yych = *++YYCURSOR; @@ -13214,7 +13214,7 @@ yy816: YYDEBUG(816, *YYCURSOR); ++YYCURSOR; YYDEBUG(817, *YYCURSOR); -#line 1440 "ext/date/lib/parse_date.re" +#line 1440 "parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); @@ -13232,7 +13232,7 @@ yy816: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13236 "ext/date/lib/parse_date.c" +#line 13236 "<stdout>" yy818: YYDEBUG(818, *YYCURSOR); yych = *++YYCURSOR; @@ -13296,7 +13296,7 @@ yy820: } yy821: YYDEBUG(821, *YYCURSOR); -#line 1426 "ext/date/lib/parse_date.re" +#line 1426 "parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13309,7 +13309,7 @@ yy821: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 13313 "ext/date/lib/parse_date.c" +#line 13313 "<stdout>" yy822: YYDEBUG(822, *YYCURSOR); yych = *++YYCURSOR; @@ -13412,7 +13412,7 @@ yy841: ++YYCURSOR; yy842: YYDEBUG(842, *YYCURSOR); -#line 1400 "ext/date/lib/parse_date.re" +#line 1400 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -13437,7 +13437,7 @@ yy842: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 13441 "ext/date/lib/parse_date.c" +#line 13441 "<stdout>" yy843: YYDEBUG(843, *YYCURSOR); yych = *++YYCURSOR; @@ -13699,7 +13699,7 @@ yy847: } yy848: YYDEBUG(848, *YYCURSOR); -#line 1388 "ext/date/lib/parse_date.re" +#line 1388 "parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -13710,7 +13710,7 @@ yy848: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 13714 "ext/date/lib/parse_date.c" +#line 13714 "<stdout>" yy849: YYDEBUG(849, *YYCURSOR); yych = *++YYCURSOR; @@ -14630,7 +14630,7 @@ yy972: if (yych <= '9') goto yy995; yy973: YYDEBUG(973, *YYCURSOR); -#line 1265 "ext/date/lib/parse_date.re" +#line 1265 "parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -14643,7 +14643,7 @@ yy973: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14647 "ext/date/lib/parse_date.c" +#line 14647 "<stdout>" yy974: YYDEBUG(974, *YYCURSOR); yyaccept = 22; @@ -15652,7 +15652,7 @@ yy1065: } yy1067: YYDEBUG(1067, *YYCURSOR); -#line 1157 "ext/date/lib/parse_date.re" +#line 1157 "parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -15674,7 +15674,7 @@ yy1067: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 15678 "ext/date/lib/parse_date.c" +#line 15678 "<stdout>" yy1068: YYDEBUG(1068, *YYCURSOR); yych = *++YYCURSOR; @@ -15766,7 +15766,7 @@ yy1074: } yy1075: YYDEBUG(1075, *YYCURSOR); -#line 1203 "ext/date/lib/parse_date.re" +#line 1203 "parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -15785,7 +15785,7 @@ yy1075: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 15789 "ext/date/lib/parse_date.c" +#line 15789 "<stdout>" yy1076: YYDEBUG(1076, *YYCURSOR); yyaccept = 25; @@ -16683,7 +16683,7 @@ yy1116: } yy1117: YYDEBUG(1117, *YYCURSOR); -#line 1599 "ext/date/lib/parse_date.re" +#line 1599 "parse_date.re" { timelib_sll i; int behavior = 0; @@ -16699,7 +16699,7 @@ yy1117: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16703 "ext/date/lib/parse_date.c" +#line 16703 "<stdout>" yy1118: YYDEBUG(1118, *YYCURSOR); ++YYCURSOR; @@ -16750,7 +16750,7 @@ yy1125: YYDEBUG(1125, *YYCURSOR); ++YYCURSOR; YYDEBUG(1126, *YYCURSOR); -#line 1072 "ext/date/lib/parse_date.re" +#line 1072 "parse_date.re" { timelib_sll i; int behavior = 0; @@ -16771,7 +16771,7 @@ yy1125: TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 16775 "ext/date/lib/parse_date.c" +#line 16775 "<stdout>" yy1127: YYDEBUG(1127, *YYCURSOR); yyaccept = 26; @@ -16879,7 +16879,7 @@ yy1140: } yy1141: YYDEBUG(1141, *YYCURSOR); -#line 1575 "ext/date/lib/parse_date.re" +#line 1575 "parse_date.re" { timelib_sll i; int behavior = 0; @@ -16902,7 +16902,7 @@ yy1141: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16906 "ext/date/lib/parse_date.c" +#line 16906 "<stdout>" yy1142: YYDEBUG(1142, *YYCURSOR); yych = *++YYCURSOR; @@ -19579,7 +19579,7 @@ yy1293: goto yy1297; yy1294: YYDEBUG(1294, *YYCURSOR); -#line 1049 "ext/date/lib/parse_date.re" +#line 1049 "parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -19601,7 +19601,7 @@ yy1294: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19605 "ext/date/lib/parse_date.c" +#line 19605 "<stdout>" yy1295: YYDEBUG(1295, *YYCURSOR); yyaccept = 28; @@ -19862,7 +19862,7 @@ yy1315: YYDEBUG(1315, *YYCURSOR); ++YYCURSOR; YYDEBUG(1316, *YYCURSOR); -#line 1032 "ext/date/lib/parse_date.re" +#line 1032 "parse_date.re" { DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; @@ -19878,7 +19878,7 @@ yy1315: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19882 "ext/date/lib/parse_date.c" +#line 19882 "<stdout>" yy1317: YYDEBUG(1317, *YYCURSOR); yyaccept = 0; @@ -21309,7 +21309,7 @@ yy1385: if (yych <= '9') goto yy1385; yy1387: YYDEBUG(1387, *YYCURSOR); -#line 1006 "ext/date/lib/parse_date.re" +#line 1006 "parse_date.re" { timelib_ull i; @@ -21334,7 +21334,7 @@ yy1387: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21338 "ext/date/lib/parse_date.c" +#line 21338 "<stdout>" yy1388: YYDEBUG(1388, *YYCURSOR); yych = *++YYCURSOR; @@ -21770,7 +21770,7 @@ yy1416: ++YYCURSOR; yy1417: YYDEBUG(1417, *YYCURSOR); -#line 994 "ext/date/lib/parse_date.re" +#line 994 "parse_date.re" { DEBUG_OUTPUT("tomorrow"); TIMELIB_INIT; @@ -21781,7 +21781,7 @@ yy1417: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21785 "ext/date/lib/parse_date.c" +#line 21785 "<stdout>" yy1418: YYDEBUG(1418, *YYCURSOR); yych = *++YYCURSOR; @@ -21816,7 +21816,7 @@ yy1419: } yy1420: YYDEBUG(1420, *YYCURSOR); -#line 984 "ext/date/lib/parse_date.re" +#line 984 "parse_date.re" { DEBUG_OUTPUT("midnight | today"); TIMELIB_INIT; @@ -21825,7 +21825,7 @@ yy1420: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21829 "ext/date/lib/parse_date.c" +#line 21829 "<stdout>" yy1421: YYDEBUG(1421, *YYCURSOR); yych = *++YYCURSOR; @@ -23837,7 +23837,7 @@ yy1499: } yy1500: YYDEBUG(1500, *YYCURSOR); -#line 963 "ext/date/lib/parse_date.re" +#line 963 "parse_date.re" { DEBUG_OUTPUT("now"); TIMELIB_INIT; @@ -23845,7 +23845,7 @@ yy1500: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23849 "ext/date/lib/parse_date.c" +#line 23849 "<stdout>" yy1501: YYDEBUG(1501, *YYCURSOR); yych = *++YYCURSOR; @@ -23984,7 +23984,7 @@ yy1507: } yy1508: YYDEBUG(1508, *YYCURSOR); -#line 972 "ext/date/lib/parse_date.re" +#line 972 "parse_date.re" { DEBUG_OUTPUT("noon"); TIMELIB_INIT; @@ -23995,7 +23995,7 @@ yy1508: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23999 "ext/date/lib/parse_date.c" +#line 23999 "<stdout>" yy1509: YYDEBUG(1509, *YYCURSOR); yyaccept = 0; @@ -24528,7 +24528,7 @@ yy1530: ++YYCURSOR; yy1531: YYDEBUG(1531, *YYCURSOR); -#line 951 "ext/date/lib/parse_date.re" +#line 951 "parse_date.re" { DEBUG_OUTPUT("yesterday"); TIMELIB_INIT; @@ -24539,7 +24539,7 @@ yy1531: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24543 "ext/date/lib/parse_date.c" +#line 24543 "<stdout>" yy1532: YYDEBUG(1532, *YYCURSOR); yyaccept = 0; @@ -24712,7 +24712,7 @@ yy1537: goto yy1531; } } -#line 1725 "ext/date/lib/parse_date.re" +#line 1725 "parse_date.re" } @@ -24725,7 +24725,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; @@ -24753,7 +24753,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; @@ -24789,7 +24789,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 { @@ -24840,7 +24840,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; @@ -25183,14 +25183,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; } |
