~javier-lopez/ubuntu/vivid/ruby1.9.1/fix-1426828

« back to all changes in this revision

Viewing changes to ext/pathname/pathname.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-11-25 09:59:41 UTC
  • mfrom: (21.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20131125095941-aou3ymnwm79em09y
Tags: 1.9.3.448-1ubuntu1
* Merge from Debian. Remaining changes:
  - debian/control: Add ca-certificates to libruby1.9.1 depends so that
    rubygems can perform certificate verification
  - debian/rules: Don't install SSL certificates from upstream sources
  - debian/patches/20120927-rubygems_disable_upstream_certs.patch: Use
    /etc/ssl/certs/ca-certificates.crt for the trusted CA certificates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "ruby.h"
 
2
#include "ruby/encoding.h"
2
3
 
3
4
static VALUE rb_cPathname;
4
5
static ID id_at_path, id_to_path;
184
185
 
185
186
    StringValue(repl);
186
187
    p = RSTRING_PTR(str);
187
 
    ext = ruby_find_extname(p, &extlen);
 
188
    extlen = RSTRING_LEN(str);
 
189
    ext = ruby_enc_find_extname(p, &extlen, rb_enc_get(str));
188
190
    if (ext == NULL) {
189
191
        ext = p + RSTRING_LEN(str);
190
192
    }
191
193
    else if (extlen <= 1) {
192
194
        ext += extlen;
193
195
    }
194
 
    str2 = rb_str_dup(str);
195
 
    rb_str_resize(str2, ext-p);
 
196
    str2 = rb_str_subseq(str, 0, ext-p);
196
197
    rb_str_append(str2, repl);
197
198
    OBJ_INFECT(str2, str);
198
199
    return rb_class_new_instance(1, &str2, rb_obj_class(self));