summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dump.c b/src/dump.c
index b73e7104e..ba5a69a56 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -10,6 +10,7 @@
#include "mruby/string.h"
#include "mruby/irep.h"
+#include "mruby/numeric.h"
static const unsigned char def_rite_binary_header[] =
RITE_FILE_IDENFIFIER
@@ -242,8 +243,8 @@ get_pool_block_size(mrb_state *mrb, mrb_irep *irep, int type)
switch (mrb_type(irep->pool[pool_no])) {
case MRB_TT_FIXNUM:
- len = mrb_int_to_str( buf, mrb_fixnum(irep->pool[pool_no]));
- size += (uint32_t)len;
+ str = mrb_fix2str(mrb, irep->pool[pool_no], 10);
+ size += (uint32_t)RSTRING_LEN(str);
break;
case MRB_TT_FLOAT:
len = mrb_float_to_str( buf, mrb_float(irep->pool[pool_no]));
@@ -359,7 +360,9 @@ write_pool_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type)
switch (mrb_type(irep->pool[pool_no])) {
case MRB_TT_FIXNUM:
- len = mrb_int_to_str(char_buf, mrb_fixnum(irep->pool[pool_no]));
+ str = mrb_fix2str(mrb, irep->pool[pool_no], 10);
+ memcpy(char_buf, RSTRING_PTR(str), RSTRING_LEN(str));
+ len = RSTRING_LEN(str);
break;
case MRB_TT_FLOAT: