Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ext/date/date_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3878,7 +3878,6 @@ static VALUE
rt_complete_frags(VALUE klass, VALUE hash)
{
static VALUE tab = Qnil;
int g;
long e;
VALUE k, a, d;

Expand Down Expand Up @@ -3975,9 +3974,13 @@ rt_complete_frags(VALUE klass, VALUE hash)
rb_gc_register_mark_object(tab);
}

k = Qnil;

{
long i, eno = 0, idx = 0;
long i, eno = 0;
VALUE t = Qnil;

e = 0;
for (i = 0; i < RARRAY_LEN(tab); i++) {
VALUE x, a;

Expand All @@ -3992,23 +3995,20 @@ rt_complete_frags(VALUE klass, VALUE hash)
n++;
if (n > eno) {
eno = n;
idx = i;
t = x;
}
}
}
if (eno == 0)
g = 0;
else {
g = 1;
k = RARRAY_AREF(RARRAY_AREF(tab, idx), 0);
a = RARRAY_AREF(RARRAY_AREF(tab, idx), 1);
e = eno;
if (eno > 0) {
k = RARRAY_AREF(t, 0);
a = RARRAY_AREF(t, 1);
}
e = eno;
}

d = Qnil;

if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
if (!NIL_P(k) && (RARRAY_LEN(a) > e)) {
if (k == sym("ordinal")) {
if (NIL_P(ref_hash("year"))) {
if (NIL_P(d))
Expand Down Expand Up @@ -4095,7 +4095,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
}
}

if (g && k == sym("time")) {
if (k == sym("time")) {
if (f_le_p(klass, cDateTime)) {
if (NIL_P(d))
d = date_s_today(0, (VALUE *)0, cDate);
Expand Down
33 changes: 30 additions & 3 deletions ext/date/zonetab.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* ANSI-C code produced by gperf version 3.1 */
/* ANSI-C code produced by gperf version 3.3 */
/* Command-line: gperf --ignore-case -L ANSI-C -C -c -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
/* Computed positions: -k'1-4,9' */

Expand Down Expand Up @@ -51,7 +51,7 @@ struct zone;

#ifndef GPERF_DOWNCASE
#define GPERF_DOWNCASE 1
static unsigned char gperf_downcase[256] =
static const unsigned char gperf_downcase[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
Expand Down Expand Up @@ -144,19 +144,39 @@ hash (register const char *str, register size_t len)
{
default:
hval += asso_values[(unsigned char)str[8]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 8:
case 7:
case 6:
case 5:
case 4:
hval += asso_values[(unsigned char)str[3]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+6];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]+52];
Expand Down Expand Up @@ -807,6 +827,10 @@ static const struct stringpool_t stringpool_contents =
const struct zone *
zonetab (register const char *str, register size_t len)
{
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
static const struct zone wordlist[] =
{
{-1}, {-1},
Expand Down Expand Up @@ -1541,6 +1565,9 @@ zonetab (register const char *str, register size_t len)
#line 141 "zonetab.list"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str619, -10800}
};
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic pop
#endif

if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
Expand All @@ -1558,7 +1585,7 @@ zonetab (register const char *str, register size_t len)
}
}
}
return 0;
return (struct zone *) 0;
}
#line 330 "zonetab.list"