[前][次][番号順一覧][スレッド一覧]

ruby-changes:12993

From: nobu <ko1@a...>
Date: Wed, 2 Sep 2009 13:48:04 +0900 (JST)
Subject: [ruby-changes:12993] Ruby:r24737 (ruby_1_8, trunk): * math.c (domain_check): simplified.

nobu	2009-09-02 13:47:39 +0900 (Wed, 02 Sep 2009)

  New Revision: 24737

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24737

  Log:
    * math.c (domain_check): simplified.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/math.c
    branches/ruby_1_8/version.h
    trunk/ChangeLog
    trunk/math.c

Index: math.c
===================================================================
--- math.c	(revision 24736)
+++ math.c	(revision 24737)
@@ -25,21 +25,18 @@
 static void
 domain_check(double x, double y, const char *msg)
 {
-    while(1) {
-	if (errno) {
-	    rb_sys_fail(msg);
-	}
-	if (isnan(y)) {
-	    if (isnan(x)) break;
+    if (!isnan(y)) return;
+    else if (isnan(x)) return;
+    else {
+	if (!errno) {
 #if defined(EDOM)
 	    errno = EDOM;
-#elif defined(ERANGE)
+#else
 	    errno = ERANGE;
 #endif
-	    continue;
 	}
-	break;
     }
+    rb_sys_fail(msg);
 }
 
 static void
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24736)
+++ ChangeLog	(revision 24737)
@@ -1,3 +1,7 @@
+Wed Sep  2 13:47:30 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* math.c (domain_check): simplified.
+
 Wed Sep  2 11:32:24 2009  Koichi Sasada  <ko1@a...>
 
 	* gc.c (obj_free): fix to free method table (fix memory leak).
Index: ruby_1_8/math.c
===================================================================
--- ruby_1_8/math.c	(revision 24736)
+++ ruby_1_8/math.c	(revision 24737)
@@ -29,20 +29,17 @@
     double x;
     const char *msg;
 {
-    while(1) {
-	if (errno) {
-	    rb_sys_fail(msg);
-	}
-	if (isnan(x)) {
+    if (!isnan(x)) return;
+    else {
+	if (!errno) {
 #if defined(EDOM)
 	    errno = EDOM;
-#elif defined(ERANGE)
+#else
 	    errno = ERANGE;
 #endif
-	    continue;
 	}
-	break;
     }
+    rb_sys_fail(msg);
 }
 
 
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 24736)
+++ ruby_1_8/ChangeLog	(revision 24737)
@@ -1,3 +1,7 @@
+Wed Sep  2 13:47:30 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* math.c (domain_check): simplified.
+
 Sun Aug 30 15:12:22 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* gc.c (gc_sweep): makes new room if object space is full of
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 24736)
+++ ruby_1_8/version.h	(revision 24737)
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.8"
-#define RUBY_RELEASE_DATE "2009-08-30"
+#define RUBY_RELEASE_DATE "2009-09-02"
 #define RUBY_VERSION_CODE 188
-#define RUBY_RELEASE_CODE 20090830
+#define RUBY_RELEASE_CODE 20090902
 #define RUBY_PATCHLEVEL -1
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 8
 #define RUBY_RELEASE_YEAR 2009
-#define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 30
+#define RUBY_RELEASE_MONTH 9
+#define RUBY_RELEASE_DAY 2
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]