summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-26 09:45:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-26 09:45:09 +0000
commit05da25f297c4d26b6bb454a9649b1dd63a102910 (patch)
tree568d1118ca9c2c7bfbcaf2d2132a7e870367d407 /sprintf.c
parent839f4c5f3fdb4ea6b270fce17f1c3881060087d4 (diff)
980626
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sprintf.c b/sprintf.c
index bc7f77b..dac3659 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -141,14 +141,13 @@ f_sprintf(argc, argv)
((argc == 0)?(ArgError("too few argument."),0):(argc--,((argv++)[0])))
fmt = GETARG();
- Check_Type(fmt, T_STRING);
-
+ p = str2cstr(fmt, &blen);
+ end = p + blen;
blen = 0;
bsiz = 120;
buf = ALLOC_N(char, bsiz);
- end = RSTRING(fmt)->ptr + RSTRING(fmt)->len;
- for (p = RSTRING(fmt)->ptr; p < end; p++) {
+ for (; p < end; p++) {
char *t;
for (t = p; t < end && *t != '%'; t++) ;