summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-20 07:42:03 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-20 07:42:03 +0000
commit88eef2d7fec7a3380f495d768c72d1292260ea18 (patch)
tree3babd1780de60f5918ec26d7c516b2495d4302cc
parent86833594ff917d578aa24a4536995fa6573300a6 (diff)
* configure.in: add check for negative time_t for gmtime(3).
* time.c (time_new_internal): no positive check if gmtime(3) can handle negative time_t. * time.c (time_timeval): ditto. * bignum.c (rb_big2long): should not raise RangeError for Bignum LONG_MIN value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--README10
-rw-r--r--bignum.c2
-rw-r--r--configure.in36
-rw-r--r--signal.c2
-rw-r--r--time.c8
-rw-r--r--version.h4
7 files changed, 65 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 02a440f..36be371 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Tue Feb 20 16:37:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * configure.in: add check for negative time_t for gmtime(3).
+
+ * time.c (time_new_internal): no positive check if gmtime(3) can
+ handle negative time_t.
+
+ * time.c (time_timeval): ditto.
+
+ * bignum.c (rb_big2long): should not raise RangeError for Bignum
+ LONG_MIN value.
+
Mon Feb 19 17:46:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_substr): "a"[1,2] should return ""; need
diff --git a/README b/README
index f924702..97d940f 100644
--- a/README
+++ b/README
@@ -22,14 +22,14 @@ Perl). It is simple, straight-forward, and extensible.
The Ruby distribution can be found on:
- ftp://ftp.netlab.co.jp/pub/lang/ruby/
+ ftp://ftp.ruby-lang.org/pub/lang/ruby/
You can get it by anonymous CVS. How to check out is:
- $ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs login
- (Logging in to anonymous@cvs.netlab.co.jp)
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/home/cvs login
+ (Logging in to anonymous@cvs.ruby-lang.org)
CVS password: guest
- $ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs checkout ruby
+ $ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/home/cvs checkout ruby
* Mailing list
@@ -40,7 +40,7 @@ To subscribe this list, please send the following phrase
e.g.
subscribe Joseph Smith
-in the mail body (not subject) to the address <ruby-talk-ctl@netlab.co.jp>.
+in the mail body (not subject) to the address <ruby-talk-ctl@ruby-lang.org>.
* How to compile and install
diff --git a/bignum.c b/bignum.c
index 39d90aa..bc473340 100644
--- a/bignum.c
+++ b/bignum.c
@@ -467,7 +467,7 @@ rb_big2long(x)
{
unsigned long num = big2ulong(x, "int");
- if ((long)num < 0) {
+ if ((long)num < 0 && (long)num != LONG_MIN) {
rb_raise(rb_eRangeError, "bignum too big to convert into `int'");
}
if (!RBIGNUM(x)->sign) return -(long)num;
diff --git a/configure.in b/configure.in
index 0c4f0ad..9d42330 100644
--- a/configure.in
+++ b/configure.in
@@ -261,6 +261,42 @@ AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
if test "$rb_cv_have_daylight" = yes; then
AC_DEFINE(HAVE_DAYLIGHT)
fi
+AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
+ [AC_TRY_RUN([
+#include <time.h>
+
+void
+check(tm, y, m, d, h, s)
+ struct tm *tm;
+ int y, m, d, h, s;
+{
+ if (tm->tm_year != y ||
+ tm->tm_mon != m-1 ||
+ tm->tm_mday != d ||
+ tm->tm_hour != h ||
+ tm->tm_sec != s) {
+ exit(1);
+ }
+}
+
+int
+main()
+{
+ time_t t = -1;
+ struct tm *tm;
+
+ check(gmtime(&t), 69, 12, 31, 23, 59);
+ t = -0x80000000;
+ check(gmtime(&t), 1, 12, 13, 20, 52);
+ return 0;
+}
+],
+ rb_cv_negative_time_t=yes,
+ rb_cv_negative_time_t=no,
+ rb_cv_negative_time_t=yes)])
+if test "$rb_cv_negative_time_t" = yes; then
+ AC_DEFINE(NEGATIVE_TIME_T)
+fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
diff --git a/signal.c b/signal.c
index ca4cded..b9c5d66 100644
--- a/signal.c
+++ b/signal.c
@@ -387,7 +387,7 @@ sigsegv(sig)
#endif
#ifdef SIGPIPE
-static RETSIGTYPE sigsegv _((int));
+static RETSIGTYPE sigpipe _((int));
static RETSIGTYPE
sigpipe(sig)
int sig;
diff --git a/time.c b/time.c
index 4648611..8da0daf 100644
--- a/time.c
+++ b/time.c
@@ -80,8 +80,10 @@ time_new_internal(klass, sec, usec)
VALUE obj;
struct time_object *tobj;
+#ifndef NEGATIVE_TIME_T
if (sec < 0 || (sec == 0 && usec < 0))
rb_raise(rb_eArgError, "time must be positive");
+#endif
obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj);
tobj->tm_got = 0;
@@ -108,22 +110,28 @@ time_timeval(time, interval)
switch (TYPE(time)) {
case T_FIXNUM:
t.tv_sec = FIX2LONG(time);
+#ifndef NEGATIVE_TIME_T
if (t.tv_sec < 0)
rb_raise(rb_eArgError, "time must be positive");
+#endif
t.tv_usec = 0;
break;
case T_FLOAT:
+#ifndef NEGATIVE_TIME_T
if (RFLOAT(time)->value < 0.0)
rb_raise(rb_eArgError, "time must be positive");
+#endif
t.tv_sec = (time_t)RFLOAT(time)->value;
t.tv_usec = (time_t)((RFLOAT(time)->value - (double)t.tv_sec)*1e6);
break;
case T_BIGNUM:
t.tv_sec = NUM2LONG(time);
+#ifndef NEGATIVE_TIME_T
if (t.tv_sec < 0)
rb_raise(rb_eArgError, "time must be positive");
+#endif
t.tv_usec = 0;
break;
diff --git a/version.h b/version.h
index 1673526..1d4cf05 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.0"
-#define RUBY_RELEASE_DATE "2001-02-19"
+#define RUBY_RELEASE_DATE "2001-02-20"
#define RUBY_VERSION_CODE 170
-#define RUBY_RELEASE_CODE 20010219
+#define RUBY_RELEASE_CODE 20010220