summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sprintf.c b/sprintf.c
index 2dd7812254..5552befe20 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -174,8 +174,9 @@ rb_f_sprintf(argc, argv)
fmt = GETARG();
if (OBJ_TAINTED(fmt)) tainted = 1;
- p = rb_str2cstr(fmt, &blen);
- end = p + blen;
+ StringValue(fmt);
+ p = RSTRING(fmt)->ptr;
+ end = p + RSTRING(fmt)->len;
blen = 0;
bsiz = 120;
buf = ALLOC_N(char, bsiz);