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

ruby-changes:64832

From: Kenta <ko1@a...>
Date: Tue, 12 Jan 2021 09:49:01 +0900 (JST)
Subject: [ruby-changes:64832] 78d3813c74 (master): [ruby/bigdecimal] Add rb_cstr_convert_to_BigDecimal

https://git.ruby-lang.org/ruby.git/commit/?id=78d3813c74

From 78d3813c74c3dd37eb3a7d5fa2fb096566c0b290 Mon Sep 17 00:00:00 2001
From: Kenta Murata <mrkn@m...>
Date: Tue, 12 Jan 2021 09:19:14 +0900
Subject: [ruby/bigdecimal] Add rb_cstr_convert_to_BigDecimal

https://github.com/ruby/bigdecimal/commit/ac230a996e

diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 3432aa2..02879a9 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2839,18 +2839,24 @@ rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2839
 }
 
 static VALUE
-rb_str_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
+rb_cstr_convert_to_BigDecimal(const char *c_str, size_t digs, int raise_exception)
 {
     if (digs == SIZE_MAX)
         digs = 0;
 
-    const char *c_str = StringValueCStr(val);
     Real *vp = VpCreateRbObject(digs, c_str, raise_exception);
     if (!vp)
         return Qnil;
     return VpCheckGetValue(vp);
 }
 
+static inline VALUE
+rb_str_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
+{
+    const char *c_str = StringValueCStr(val);
+    return rb_cstr_convert_to_BigDecimal(c_str, digs, raise_exception);
+}
+
 static VALUE
 rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
 {
-- 
cgit v0.10.2


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

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