[ruby/bigdecimal] Add rb_cstr_convert_to_BigDecimal
https://github.com/ruby/bigdecimal/commit/ac230a996e
This commit is contained in:
parent
66a844fd07
commit
78d3813c74
@ -2839,18 +2839,24 @@ rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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)
|
if (digs == SIZE_MAX)
|
||||||
digs = 0;
|
digs = 0;
|
||||||
|
|
||||||
const char *c_str = StringValueCStr(val);
|
|
||||||
Real *vp = VpCreateRbObject(digs, c_str, raise_exception);
|
Real *vp = VpCreateRbObject(digs, c_str, raise_exception);
|
||||||
if (!vp)
|
if (!vp)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
return VpCheckGetValue(vp);
|
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
|
static VALUE
|
||||||
rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
|
rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user