diff options
| author | Masaki Muranaka <[email protected]> | 2013-02-23 21:21:15 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-02-23 21:21:15 +0900 |
| commit | dd6234974932382181ced7a813ad71d426d1e0ab (patch) | |
| tree | bc894c89ed5603d3a39ad9e6af1308290cb1c593 /src/dump.c | |
| parent | 58b9e7672474160df90ba11c915eeac093fe12d2 (diff) | |
| download | mruby-dd6234974932382181ced7a813ad71d426d1e0ab.tar.gz mruby-dd6234974932382181ced7a813ad71d426d1e0ab.zip | |
Reduce sprintf() calls. Remove mrb_int_to_str() and MRB_INT_FORMAT.
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dump.c b/src/dump.c index e8d96c570..b97b38dc2 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 @@ -241,8 +242,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])); @@ -358,7 +359,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: |
