From 2d035410e09f113469fccec4e71e03547068b4ee Mon Sep 17 00:00:00 2001 From: sue445 Date: Thu, 6 Mar 2025 23:39:50 +0900 Subject: [PATCH] Treat `RSTRING_END` return value as a `char*` instead of `string` `RSTRING_END` expects pointer to return https://github.com/ruby/ruby/blob/v3_4_2/include/ruby/internal/core/rstring.h#L434-L442 --- config/default.yml.erb | 2 ++ spec/ruby_header_parser/parser_spec.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/default.yml.erb b/config/default.yml.erb index 5dacaba..1c395b5 100644 --- a/config/default.yml.erb +++ b/config/default.yml.erb @@ -81,6 +81,8 @@ function: <% end %> pointer_hint: + RSTRING_END: + self: raw RSTRING_PTR: self: raw rb_data_object_make: diff --git a/spec/ruby_header_parser/parser_spec.rb b/spec/ruby_header_parser/parser_spec.rb index b829cdc..bab40ce 100644 --- a/spec/ruby_header_parser/parser_spec.rb +++ b/spec/ruby_header_parser/parser_spec.rb @@ -310,7 +310,7 @@ its(:name) { should eq "RSTRING_END" } its(:definition) { should eq "RSTRING_END(VALUE str)" } - its(:typeref) { should eq typeref(type: "char", pointer: :ref) } + its(:typeref) { should eq typeref(type: "char", pointer: :raw) } its(:args) { should eq args } end