mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* hash.c (inspect_i): copy the encoding of the first key as
an initial encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
366e1c3884
commit
7798b9667e
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Feb 15 15:40:53 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* hash.c (inspect_i): copy the encoding of the first key as
|
||||
an initial encoding.
|
||||
|
||||
Mon Feb 14 15:00:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* array.c (inspect_ary): don't taint the inspected result of a
|
||||
|
|
6
hash.c
6
hash.c
|
@ -14,6 +14,7 @@
|
|||
#include "ruby/ruby.h"
|
||||
#include "ruby/st.h"
|
||||
#include "ruby/util.h"
|
||||
#include "ruby/encoding.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -1367,10 +1368,13 @@ inspect_i(VALUE key, VALUE value, VALUE str)
|
|||
VALUE str2;
|
||||
|
||||
if (key == Qundef) return ST_CONTINUE;
|
||||
str2 = rb_inspect(key);
|
||||
if (RSTRING_LEN(str) > 1) {
|
||||
rb_str_cat2(str, ", ");
|
||||
}
|
||||
str2 = rb_inspect(key);
|
||||
else {
|
||||
rb_enc_copy(str, str2);
|
||||
}
|
||||
rb_str_buf_append(str, str2);
|
||||
OBJ_INFECT(str, str2);
|
||||
rb_str_buf_cat2(str, "=>");
|
||||
|
|
Loading…
Add table
Reference in a new issue