From 4e273f76763d783852a01e58feb81e6e074d671f Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 3 Jul 2012 15:38:58 +0000 Subject: Revert r36279; it breaks C API compatibility. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pathname/pathname.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index e35c19d541..e1632c524b 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -1,5 +1,4 @@ #include "ruby.h" -#include "ruby/encoding.h" static VALUE rb_cPathname; static ID id_at_path, id_to_path; @@ -185,15 +184,15 @@ path_sub_ext(VALUE self, VALUE repl) StringValue(repl); p = RSTRING_PTR(str); - extlen = RSTRING_LEN(str); - ext = ruby_enc_find_extname(p, &extlen, rb_enc_get(str)); + ext = ruby_find_extname(p, &extlen); if (ext == NULL) { ext = p + RSTRING_LEN(str); } else if (extlen <= 1) { ext += extlen; } - str2 = rb_str_subseq(str, 0, ext-p); + str2 = rb_str_dup(str); + rb_str_resize(str2, ext-p); rb_str_append(str2, repl); OBJ_INFECT(str2, str); return rb_class_new_instance(1, &str2, rb_obj_class(self)); -- cgit v1.2.3