[macruby-changes] [2615] MacRuby/trunk/include/ruby/ruby.h

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 22 22:35:06 PDT 2009


Revision: 2615
          http://trac.macosforge.org/projects/ruby/changeset/2615
Author:   lsansonetti at apple.com
Date:     2009-09-22 22:35:03 -0700 (Tue, 22 Sep 2009)
Log Message:
-----------
make sure RFLOAT_VALUE() doesn't eval its argument twice

Modified Paths:
--------------
    MacRuby/trunk/include/ruby/ruby.h

Modified: MacRuby/trunk/include/ruby/ruby.h
===================================================================
--- MacRuby/trunk/include/ruby/ruby.h	2009-09-23 04:49:31 UTC (rev 2614)
+++ MacRuby/trunk/include/ruby/ruby.h	2009-09-23 05:35:03 UTC (rev 2615)
@@ -592,7 +592,13 @@
     struct RBasic basic;
     double float_value;
 };
-#define RFLOAT_VALUE(v) (FIXFLOAT_P(v) ? FIXFLOAT2DBL(v) : RFLOAT(v)->float_value)
+
+static inline double
+__rb_float_value(VALUE v)
+{
+    return FIXFLOAT_P(v) ? FIXFLOAT2DBL(v) : ((struct RFloat *)v)->float_value;
+}
+#define RFLOAT_VALUE(v) (__rb_float_value((VALUE)v))
 #define DOUBLE2NUM(dbl)  rb_float_new(dbl)
 
 #if WITH_OBJC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090922/6fa61139/attachment.html>


More information about the macruby-changes mailing list