summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
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 bc7f77bfb6..dac3659525 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++) ;