Issue #13381 has been updated by Eregon (Benoit Daloze).


I'd suggest `buff` => `buffer`, I don't think it's worth abbreviating that.
BTW, there is `rb_alloc_tmp_buffer` so `buff` would be inconsistent.

Is `rb_str_pool(VALUE)` useful?
I think it could be `rb_str_uminus()` (or just `rb_funcall(str, rb_intern("-@"))`).
And then we could be consistent with `rb_str_new*`, and drop confusing `_buff` suffixes (not really buffer (=> sounds mutable), just a C string with known length).

So I think this is better:
```
rb_str_uminus(VALUE) // or just rb_funcall(str, rb_intern("-@"))
rb_str_pool(const char *ptr, long len)
rb_str_pool_cstr(const char *ptr)
rb_enc_str_pool(const char *ptr, long len, rb_encoding *enc)
rb_enc_str_pool_cstr(const char *ptr, rb_encoding *enc)
```

----------------------------------------
Feature #13381: [PATCH] Expose rb_fstring and its family to C extensions
https://bugs.ruby-lang.org/issues/13381#change-86579

* Author: eagletmt (Kohei Suzuki)
* Status: Assigned
* Priority: Normal
----------------------------------------
https://github.com/ruby/ruby/pull/1559

Currently, C extensions cannot use fstrings. I'd like to use
`rb_fstring_cstr` instead of `rb_str_new_cstr` for static strings in C
extensions to avoid excess allocation.

I think there's several use cases.

- https://github.com/k0kubun/hamlit/blob/v2.8.0/ext/hamlit/hamlit.c#L508-L512
- https://bitbucket.org/ged/ruby-pg/src/e5eb92cca97abc0c6fc168acfad993c2ad314589/ext/pg_connection.c?at=v0.20.0&fileviewer=file-view-default#pg_connection.c-3679
- https://bitbucket.org/ged/ruby-pg/src/e5eb92cca97abc0c6fc168acfad993c2ad314589/ext/pg_copy_coder.c?at=v0.20.0&fileviewer=file-view-default#pg_copy_coder.c-38



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>