Skip to content

Commit ac230a9

Browse files
committed
Add rb_cstr_convert_to_BigDecimal
1 parent 2dad4d1 commit ac230a9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ext/bigdecimal/bigdecimal.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,18 +2842,24 @@ rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
28422842
}
28432843

28442844
static VALUE
2845-
rb_str_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
2845+
rb_cstr_convert_to_BigDecimal(const char *c_str, size_t digs, int raise_exception)
28462846
{
28472847
if (digs == SIZE_MAX)
28482848
digs = 0;
28492849

2850-
const char *c_str = StringValueCStr(val);
28512850
Real *vp = VpCreateRbObject(digs, c_str, raise_exception);
28522851
if (!vp)
28532852
return Qnil;
28542853
return VpCheckGetValue(vp);
28552854
}
28562855

2856+
static inline VALUE
2857+
rb_str_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
2858+
{
2859+
const char *c_str = StringValueCStr(val);
2860+
return rb_cstr_convert_to_BigDecimal(c_str, digs, raise_exception);
2861+
}
2862+
28572863
static VALUE
28582864
rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
28592865
{

0 commit comments

Comments
 (0)