Enc_register_at should use strdup

e$B$3$s$P$s$Oe(B sheepman e$B$G$9!#e(B

e$B<!$N$h$&$J%3!<%I$G%(%i!<$K$J$j$^$9!#e(B
require e$B$O4X78$"$j$^$;$s!#%(%s%3!<%G%#%s%0L>$rI=$9J8;zNs$,e(B
GC e$B$5$l$F$7$^$&$h$&$G$9!#e(B

$ cat t.rb
#-- coding: euc-jp --
100.times do
Encoding.find(“Windows” + “-1255”)
require ‘drb’
end

$ ruby-1.9 -v t.rb
ruby 1.9.0 (2008-01-16 revision 0) [i686-linux]
t.rb:3:in find': unknown encoding name - Windows-1255 (ArgumentError) from t.rb:4:inblock in ’
from t.rb:3:in times' from t.rb:3:in

e$B0J2<$O%Q%C%A$G$9!#e(B

Index: encoding.c

— encoding.c (revision 15080)
+++ encoding.c (working copy)
@@ -146,11 +146,11 @@
{
struct rb_encoding_entry *ent = &enc_table.list[index];

  • ent->name = name;
  • ent->name = strdup(name);
    if (!ent->enc) ent->enc = malloc(sizeof(rb_encoding));
    *ent->enc = *encoding;
    encoding = ent->enc;
  • encoding->name = name;
  • encoding->name = strdup(name);
    encoding->ruby_encoding_index = index;
    if (rb_cEncoding) {
    /* initialize encoding data */

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs