From f6f3d1bc0e24cca8e369b09c68c26813a414248a Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 12 Jan 2010 12:56:15 +0000 Subject: * string.c (rb_str_set_len): call rb_str_modify. * file.c (realpath_rec): don't call rb_str_modify before rb_str_set_len. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ file.c | 1 - string.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1f136ee90a..d7e5512891 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jan 12 21:56:00 2010 Tanaka Akira + + * string.c (rb_str_set_len): call rb_str_modify. + + * file.c (realpath_rec): don't call rb_str_modify before + rb_str_set_len. + Tue Jan 12 20:44:14 2010 Tanaka Akira * file.c (realpath_internal): call rb_secure. diff --git a/file.c b/file.c index 99435829c9..1982452ed9 100644 --- a/file.c +++ b/file.c @@ -3098,7 +3098,6 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, char *unresolved, VALUE loopche if (*prefixlenp < RSTRING_LEN(*resolvedp)) { char *resolved_names = RSTRING_PTR(*resolvedp) + *prefixlenp; long len = rb_path_last_separator(resolved_names) - resolved_names; - rb_str_modify(*resolvedp); rb_str_set_len(*resolvedp, *prefixlenp + len); } } diff --git a/string.c b/string.c index 78620b8048..29e84e3ffe 100644 --- a/string.c +++ b/string.c @@ -1667,6 +1667,7 @@ rb_str_unlocktmp(VALUE str) void rb_str_set_len(VALUE str, long len) { + rb_str_modify(str); STR_SET_LEN(str, len); RSTRING_PTR(str)[len] = '\0'; } -- cgit v1.2.3