diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-25 15:00:09 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-25 15:00:09 +0900 |
| commit | 8464cac63cce822245f76284a48d35343b680507 (patch) | |
| tree | 8d1ea23c299ce535ce31567774463b70df2c48c6 /src/string.c | |
| parent | f0bea86437e46cec11d1fe5f9c3ab7ab8933161d (diff) | |
| download | mruby-8464cac63cce822245f76284a48d35343b680507.tar.gz mruby-8464cac63cce822245f76284a48d35343b680507.zip | |
remove calling sprintf(); ref #1210
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c index be8e449c9..5152eadb3 100644 --- a/src/string.c +++ b/src/string.c @@ -2348,8 +2348,12 @@ mrb_str_dump(mrb_state *mrb, mrb_value str) *q++ = c; } else { + int oct = c & 0xff; + *q++ = '\\'; - sprintf(q, "%03o", c&0xff); + q[2] = '0' + oct % 8; oct /= 8; + q[1] = '0' + oct % 8; oct /= 8; + q[0] = '0' + oct % 8; q += 3; } } |
