From 1dbfc3999753eabaa15b461a23009086ceaa215a Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Mon, 21 May 2012 17:11:38 +0900 Subject: use mrb's allocator; thanks to @mitchblank --- src/parse.y | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/parse.y b/src/parse.y index e9348e7a1..871842668 100644 --- a/src/parse.y +++ b/src/parse.y @@ -10,6 +10,12 @@ #define YYDEBUG 1 #define YYERROR_VERBOSE 1 +/* + * Force yacc to use our memory management. This is a little evil because + * the macros assume that "parser_state *p" is in scope + */ +#define YYMALLOC(n) mrb_malloc(p->mrb, (n)) +#define YYFREE(o) mrb_free(p->mrb, (o)) #define YYSTACK_USE_ALLOCA 0 #include "mruby.h" -- cgit v1.2.3 From 826386a13adf0d645e992a862a1d3f37dc1b4853 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Mon, 21 May 2012 17:16:33 +0900 Subject: use mrb_int for struct tm fractions --- src/time.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/time.c b/src/time.c index b0a74d0d1..293eef583 100644 --- a/src/time.c +++ b/src/time.c @@ -266,8 +266,7 @@ time_mktime(mrb_state *mrb, mrb_int ayear, mrb_int amonth, mrb_int aday, static mrb_value mrb_time_gm(mrb_state *mrb, mrb_value self) { - mrb_int ayear = 0.0, amonth = 1.0, aday = 1.0, ahour = 0.0, - amin = 0.0, asec = 0.0, ausec = 0.0; + mrb_int ayear = 0, amonth = 1, aday = 1, ahour = 0, amin = 0, asec = 0, ausec = 0; mrb_get_args(mrb, "iiiiiii", &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec); @@ -281,10 +280,9 @@ mrb_time_gm(mrb_state *mrb, mrb_value self) static mrb_value mrb_time_local(mrb_state *mrb, mrb_value self) { - mrb_float ayear = 0.0, amonth = 1.0, aday = 1.0, ahour = 0.0, - amin = 0.0, asec = 0.0, ausec = 0.0; + mrb_int ayear = 0, amonth = 1, aday = 1, ahour = 0, amin = 0, asec = 0, ausec = 0; - mrb_get_args(mrb, "fffffff", + mrb_get_args(mrb, "iiiiiii", &ayear, &amonth, &aday, &ahour, &amin, &asec, &ausec); return mrb_time_wrap(mrb, mrb_class_ptr(self), time_mktime(mrb, ayear, amonth, aday, ahour, amin, asec, ausec, MRB_TIMEZONE_LOCAL)); -- cgit v1.2.3