diff options
| author | Masaki Muranaka <[email protected]> | 2013-04-25 15:36:19 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-04-25 15:36:19 +0900 |
| commit | 6684b7d1cff9eabf71fc0eea2ad06288f7c56afd (patch) | |
| tree | 3ee899809787b3bf1ed660a3c0a16e1347372759 /src/string.c | |
| parent | 433cb13e6db6c4f6761613bd0096f5d2f43f4626 (diff) | |
| download | mruby-6684b7d1cff9eabf71fc0eea2ad06288f7c56afd.tar.gz mruby-6684b7d1cff9eabf71fc0eea2ad06288f7c56afd.zip | |
Remove sprintf().
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index 5152eadb3..7ea6844a1 100644 --- a/src/string.c +++ b/src/string.c @@ -2438,8 +2438,11 @@ mrb_str_inspect(mrb_state *mrb, mrb_value str) continue; } else { - int n = sprintf(buf, "\\%03o", c & 0377); - mrb_str_buf_cat(mrb, result, buf, n); + buf[0] = '\\'; + buf[3] = '0' + c % 8; c /= 8; + buf[2] = '0' + c % 8; c /= 8; + buf[1] = '0' + c % 8; + mrb_str_buf_cat(mrb, result, buf, 4); continue; } } |
