Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ext/json/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,7 @@ NOINLINE(static) VALUE json_string_unescape(JSON_ParserState *state, JSON_Parser
}
}

char buf[4];
int unescape_len = convert_UTF32_to_UTF8(buf, ch);
MEMCPY(buffer, buf, char, unescape_len);
int unescape_len = convert_UTF32_to_UTF8(buffer, ch);
buffer += unescape_len;
p = ++pe;
break;
Expand Down
7 changes: 4 additions & 3 deletions struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ inspect_struct(VALUE s, VALUE prefix, int recur)
char first = RSTRING_PTR(cname)[0];

if (recur || first != '#') {
rb_str_cat2(str, " ");
rb_str_append(str, cname);
}
if (recur) {
Expand All @@ -997,7 +998,7 @@ inspect_struct(VALUE s, VALUE prefix, int recur)
if (i > 0) {
rb_str_cat2(str, ", ");
}
else if (first != '#') {
else {
rb_str_cat2(str, " ");
}
slot = RARRAY_AREF(members, i);
Expand Down Expand Up @@ -1031,7 +1032,7 @@ inspect_struct(VALUE s, VALUE prefix, int recur)
static VALUE
rb_struct_inspect(VALUE s)
{
return rb_exec_recursive(inspect_struct, s, rb_str_new2("#<struct "));
return rb_exec_recursive(inspect_struct, s, rb_str_new2("#<struct"));
}

/*
Expand Down Expand Up @@ -1910,7 +1911,7 @@ rb_data_with(int argc, const VALUE *argv, VALUE self)
static VALUE
rb_data_inspect(VALUE s)
{
return rb_exec_recursive(inspect_struct, s, rb_str_new2("#<data "));
return rb_exec_recursive(inspect_struct, s, rb_str_new2("#<data"));
}

/*
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_memberless
assert_equal(klass.new, test)
assert_not_equal(Data.define.new, test)

assert_equal('#<data >', test.inspect)
assert_equal('#<data>', test.inspect)
assert_equal([], test.members)
assert_equal({}, test.to_h)
assert_predicate(test, :frozen?)
Expand Down