From 849bc0234abaa8458f132981404e198666c5610b Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 5 Apr 2004 07:45:32 +0000 Subject: * eval.c (top_include): include in the wrapped load is done for the wrapper, not for a singleton class for wrapped main. [ruby-dev:23305] * bignum.c (rb_big_eq): use temporary double variable to save the result (internal float register may be bigger than 64 bits, for example, 80 bits on x86). [ruby-dev:23311] * eval.c (block_pass): should generate unique identifier of the pushing block. [ruby-talk:96363] * ext/socket/socket.c (make_hostent): fix memory leak, based on the patch from HORIKAWA Hisashi . git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'time.c') diff --git a/time.c b/time.c index 2dec206009..b6b16a1d05 100644 --- a/time.c +++ b/time.c @@ -110,10 +110,10 @@ time_init(time) #define NMOD(x,y) ((y)-(-((x)+1)%(y))-1) void -time_overflow_p(sec, usec) - time_t sec, usec; +time_overflow_p(secp, usecp) + time_t *secp, *usecp; { - time_t tmp; + time_t tmp, sec = *secp, usec = *usecp; if (usec >= 1000000) { /* usec positive overflow */ tmp = sec + usec / 1000000; @@ -135,6 +135,8 @@ time_overflow_p(sec, usec) if (sec < 0 || (sec == 0 && usec < 0)) rb_raise(rb_eArgError, "time must be positive"); #endif + *secp = sec; + *usecp = usec; } static VALUE @@ -146,7 +148,7 @@ time_new_internal(klass, sec, usec) struct time_object *tobj; GetTimeval(time, tobj); - time_overflow_p(sec, usec); + time_overflow_p(&sec, &usec); tobj->tv.tv_sec = sec; tobj->tv.tv_usec = usec; @@ -1895,7 +1897,7 @@ time_mdump(time) tm = gmtime(&t); if ((tm->tm_year & 0x1ffff) != tm->tm_year) - rb_raise(rb_eArgError, "too big year to marshal"); + rb_raise(rb_eArgError, "year too big to marshal"); p = 0x1 << 31 | /* 1 */ tm->tm_year << 14 | /* 17 */ @@ -1990,7 +1992,7 @@ time_mload(time, str) sec = make_time_t(&tm, Qtrue); usec = (time_t)(s & 0xfffff); } - time_overflow_p(sec, usec); + time_overflow_p(&sec, &usec); GetTimeval(time, tobj); tobj->tm_got = 0; -- cgit v1.2.3