Project

General

Profile

Actions

Bug #11231

closed

Should rb_alloc_tmp_buffer() be public API?

Added by Eregon (Benoit Daloze) almost 9 years ago. Updated almost 9 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[ruby-core:69482]

Description

rb_alloc_tmp_buffer() is declared in include/ruby/intern.h.

However it seems this is a fairly internal API as it deals with a VALUE pointer and has undocumented liveliness/GC behavior.

There was a try to specify it in
https://github.com/rubinius/rubinius/commit/bf0a6b988661d3917e9dcea62746b07b5f6d00ca
but this results in SEGV on MRI (I guess it is not intended usage of the API, but what would be correct usage?).

It is used in the ALLOCV() macro, which is maybe the reason why this is part of the header?

Is there a way to hide such internal function?
Or is it on purpose declared publicly?

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Description updated (diff)
  • Status changed from Open to Closed

Benoit Daloze wrote:

rb_alloc_tmp_buffer() is declared in include/ruby/intern.h.

include/ruby/ruby.h.

There was a try to specify it in
https://github.com/rubinius/rubinius/commit/bf0a6b988661d3917e9dcea62746b07b5f6d00ca
but this results in SEGV on MRI (I guess it is not intended usage of the API, but what would be correct usage?).

It is used in the ALLOCV() macro, which is maybe the reason why this is part of the header?

Yes, exactly.

Is there a way to hide such internal function?
Or is it on purpose declared publicly?

It's similar to alloca(), the result should be used only in single function.

Updated by Eregon (Benoit Daloze) almost 9 years ago

Thanks for the explanations!

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Status changed from Closed to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0