Commit 9c640a08 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1000 from iij/pr-set-data-type-asap

DATA_TYPE must be set as soon as possible
parents 4da772c0 d82fc884
...@@ -528,6 +528,8 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self) ...@@ -528,6 +528,8 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self)
if (tm) { if (tm) {
mrb_time_free(mrb, tm); mrb_time_free(mrb, tm);
} }
DATA_TYPE(self) = &mrb_time_type;
DATA_PTR(self) = NULL;
n = mrb_get_args(mrb, "|iiiiiii", n = mrb_get_args(mrb, "|iiiiiii",
&ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec); &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec);
...@@ -538,7 +540,6 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self) ...@@ -538,7 +540,6 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self)
tm = time_mktime(mrb, ayear, amonth, aday, ahour, amin, asec, ausec, MRB_TIMEZONE_LOCAL); tm = time_mktime(mrb, ayear, amonth, aday, ahour, amin, asec, ausec, MRB_TIMEZONE_LOCAL);
} }
DATA_PTR(self) = tm; DATA_PTR(self) = tm;
DATA_TYPE(self) = &mrb_time_type;
return self; return self;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment