ruby-changes:65442
From: Jean <ko1@a...>
Date: Thu, 11 Mar 2021 06:44:23 +0900 (JST)
Subject: [ruby-changes:65442] ef88225886 (master): Simplify ibf_dump_object_symbol by delegating to ibf_dump_object_string
https://git.ruby-lang.org/ruby.git/commit/?id=ef88225886 From ef88225886dd4ceecae07ddd22108ef4da542396 Mon Sep 17 00:00:00 2001 From: Jean Boussier <jean.boussier@g...> Date: Mon, 1 Feb 2021 17:58:06 +0100 Subject: Simplify ibf_dump_object_symbol by delegating to ibf_dump_object_string --- compile.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/compile.c b/compile.c index 7c0ecec..3193be8 100644 --- a/compile.c +++ b/compile.c @@ -11634,21 +11634,7 @@ ibf_load_object_complex_rational(const struct ibf_load *load, const struct ibf_o https://github.com/ruby/ruby/blob/trunk/compile.c#L11634 static void ibf_dump_object_symbol(struct ibf_dump *dump, VALUE obj) { - VALUE str = rb_sym2str(obj); - - long encindex = (long)rb_enc_get_index(str); - long len = RSTRING_LEN(str); - const char *ptr = RSTRING_PTR(str); - - if (encindex > RUBY_ENCINDEX_BUILTIN_MAX) { - rb_encoding *enc = rb_enc_from_index((int)encindex); - const char *enc_name = rb_enc_name(enc); - encindex = RUBY_ENCINDEX_BUILTIN_MAX + ibf_dump_object(dump, rb_str_new2(enc_name)); - } - - ibf_dump_write_small_value(dump, encindex); - ibf_dump_write_small_value(dump, len); - IBF_WP(ptr, char, len); + ibf_dump_object_string(dump, rb_sym2str(obj)); } static VALUE -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/