From effc5f1927b50fc279b004d26c55acf850843331 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Mon, 4 Jul 2005 07:16:09 +0000 Subject: [PATCH] - Do not crash when the abbreviation doesn't exist. --- ext/date/lib/README | 2 +- ext/date/lib/parse_date.c | 8 ++++++-- ext/date/lib/parse_date.re | 6 +++++- ext/date/lib/resource/README | 2 +- ext/date/lib/resource/parse_date.re | 6 +++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ext/date/lib/README b/ext/date/lib/README index 559c52d731..2603bc7c6f 100644 --- a/ext/date/lib/README +++ b/ext/date/lib/README @@ -3,4 +3,4 @@ Regenerating Parser Make sure you use re2c 0.9.8dev or higher: -# re2c -d -b resource/parse_date.re > parse_date.c +/dat/dev/sf/re2c/re2c -d -b resource/parse_date.re > parse_date.c diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index aca2b17706..12589e121d 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.8 on Mon Jul 4 03:23:06 2005 */ +/* Generated by re2c 0.9.8.dev on Mon Jul 4 09:14:41 2005 */ #line 1 "resource/parse_date.re" /* +----------------------------------------------------------------------+ @@ -13845,7 +13845,11 @@ char *timelib_timezone_id_from_abbr(const char *abbr) timelib_tz_lookup_table *tp; tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1); - return (tp->full_tz_name); + if (tp) { + return (tp->full_tz_name); + } else { + return NULL; + } } #ifdef DEBUG_PARSER_STUB diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index b050dad24d..ed20dddfc6 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -1469,7 +1469,11 @@ char *timelib_timezone_id_from_abbr(const char *abbr) timelib_tz_lookup_table *tp; tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1); - return (tp->full_tz_name); + if (tp) { + return (tp->full_tz_name); + } else { + return NULL; + } } #ifdef DEBUG_PARSER_STUB diff --git a/ext/date/lib/resource/README b/ext/date/lib/resource/README index 559c52d731..2603bc7c6f 100644 --- a/ext/date/lib/resource/README +++ b/ext/date/lib/resource/README @@ -3,4 +3,4 @@ Regenerating Parser Make sure you use re2c 0.9.8dev or higher: -# re2c -d -b resource/parse_date.re > parse_date.c +/dat/dev/sf/re2c/re2c -d -b resource/parse_date.re > parse_date.c diff --git a/ext/date/lib/resource/parse_date.re b/ext/date/lib/resource/parse_date.re index b050dad24d..ed20dddfc6 100644 --- a/ext/date/lib/resource/parse_date.re +++ b/ext/date/lib/resource/parse_date.re @@ -1469,7 +1469,11 @@ char *timelib_timezone_id_from_abbr(const char *abbr) timelib_tz_lookup_table *tp; tp = zone_search(abbr, 0, sizeof(timelib_timezone_lookup) / sizeof(*timelib_timezone_lookup) - 1); - return (tp->full_tz_name); + if (tp) { + return (tp->full_tz_name); + } else { + return NULL; + } } #ifdef DEBUG_PARSER_STUB -- 2.40.0