From 8464cac63cce822245f76284a48d35343b680507 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 25 Apr 2013 15:00:09 +0900 Subject: remove calling sprintf(); ref #1210 --- src/string.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/string.c') 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; } } -- cgit v1.2.3