summaryrefslogtreecommitdiff
path: root/ext/date/date_strptime.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-02 03:48:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-02 03:48:58 +0000
commite8f8cf111fc1cd6ee7a00b692ba208bd1c7ce539 (patch)
tree4823a53e50bae0a70903c7d46192c30458cf644c /ext/date/date_strptime.c
parent1ad6dde9da48149f1998eb5b85916165867c2368 (diff)
downloadruby-e8f8cf111fc1cd6ee7a00b692ba208bd1c7ce539.tar.gz
date: use del_hash to extract an element destructively
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_strptime.c')
-rw-r--r--ext/date/date_strptime.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index 4383eb6fa1..26d9fd11bf 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -669,7 +669,7 @@ date__strptime(const char *str, size_t slen,
if (fail_p())
return Qnil;
- cent = ref_hash("_cent");
+ cent = del_hash("_cent");
if (!NIL_P(cent)) {
VALUE year;
@@ -679,10 +679,9 @@ date__strptime(const char *str, size_t slen,
year = ref_hash("year");
if (!NIL_P(year))
set_hash("year", f_add(year, f_mul(cent, INT2FIX(100))));
- del_hash("_cent");
}
- merid = ref_hash("_merid");
+ merid = del_hash("_merid");
if (!NIL_P(merid)) {
VALUE hour;
@@ -691,7 +690,6 @@ date__strptime(const char *str, size_t slen,
hour = f_mod(hour, INT2FIX(12));
set_hash("hour", f_add(hour, merid));
}
- del_hash("_merid");
}
return hash;