diff options
| author | Masaki Muranaka <[email protected]> | 2012-07-16 17:54:13 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2012-07-16 17:58:20 +0900 |
| commit | cd502421462db2ad588cf8fe8c80a590f3d6f640 (patch) | |
| tree | 54c3782085b48c44a30eeb672354d2c120d857ac /src/dump.c | |
| parent | 49cac5f97db1398776e99573a62a300e3ab12ce7 (diff) | |
| download | mruby-cd502421462db2ad588cf8fe8c80a590f3d6f640.tar.gz mruby-cd502421462db2ad588cf8fe8c80a590f3d6f640.zip | |
Reduce strlen(). refs #301
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dump.c b/src/dump.c index a720090fa..d8768f771 100644 --- a/src/dump.c +++ b/src/dump.c @@ -222,15 +222,16 @@ get_pool_block_size(mrb_state *mrb, mrb_irep *irep, int type) for (pool_no = 0; pool_no < irep->plen; pool_no++) { uint16_t nlen =0; + int len; switch (irep->pool[pool_no].tt) { case MRB_TT_FIXNUM: - sprintf( buf, "%d", irep->pool[pool_no].value.i); - size += strlen(buf); + len = sprintf( buf, "%d", irep->pool[pool_no].value.i); + size += (uint32_t)len; break; case MRB_TT_FLOAT: - sprintf( buf, "%.16e", irep->pool[pool_no].value.f); - size += strlen(buf); + len = sprintf( buf, "%.16e", irep->pool[pool_no].value.f); + size += (uint32_t)len; break; case MRB_TT_STRING: str = mrb_string_value( mrb, &irep->pool[pool_no]); |
