summaryrefslogtreecommitdiff
path: root/time.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 /time.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 'time.c')
-rw-r--r--time.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/time.c b/time.c
index 00289b0553..b906bb59e6 100644
--- a/time.c
+++ b/time.c
@@ -737,18 +737,19 @@ time_strftime(time, format)
{
struct time_object *tobj;
char buffer[SMALLBUF];
+ char *fmt;
char *buf = buffer;
int len;
VALUE str;
- Check_Type(format, T_STRING);
GetTimeval(time, tobj);
if (tobj->tm_got == 0) {
time_localtime(time);
}
- if (strlen(RSTRING(format)->ptr) < RSTRING(format)->len) {
+ fmt = str2cstr(format, &len);
+ if (strlen(fmt) < len) {
/* Ruby string may contain \0's. */
- char *p = RSTRING(format)->ptr, *pe = p + RSTRING(format)->len;
+ char *p = fmt, *pe = fmt + len;
str = str_new(0, 0);
while (p < pe) {