ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: ko1@atdot.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:99199] [Ruby master Feature#13381] [PATCH] Expose rb_fstring and its family to C extensions
Date: Fri, 17 Jul 2020 04:19:22 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-86578.20200717041921.7945@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13381.20170329052912.7945@ruby-lang.org

Issue #13381 has been updated by ko1 (Koichi Sasada).


Nobu and I discussed the name, we want to choose `rb_str_pool` terminology.

* `rb_str_pool` prefix
    * `rb_str_pool(VALUE)`
    * `rb_str_pool_buff(const char *ptr, long len)`
    * `rb_str_pool_cstr(const char *ptr)`
    * `rb_enc_str_pool_buff(const char *ptr, long len, rb_encoding *enc)`
    * `rb_enc_str_pool_cstr(const char *ptr, rb_encoding *enc)`

* FYI: `rb_str_new` series:
    * `rb_str_new(const char *ptr, long len)`
    * `rb_str_new_cstr(const char *ptr)`
    * `rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)`
    * `rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc)`

If there is no comments, we will merge it soon.

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

* 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/

       reply	other threads:[~2020-07-17  4:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13381.20170329052912.7945@ruby-lang.org>
2020-07-17  4:19 ` ko1 [this message]
2020-07-17  9:22 ` [ruby-core:99200] [Ruby master Feature#13381] [PATCH] Expose rb_fstring and its family to C extensions eregontp
2020-07-20  7:25 ` [ruby-core:99236] " nobu
2020-07-20  7:51 ` [ruby-core:99237] " jean.boussier
2020-08-12  6:36 ` [ruby-core:99564] " ko1
2020-09-23  6:07 ` [ruby-core:100083] " ko1
2020-09-23  7:23 ` [ruby-core:100084] " jean.boussier
2020-09-25  1:01 ` [ruby-core:100114] " daniel
2020-11-18 15:34 ` [ruby-core:100935] " jean.boussier
2020-11-26  7:41 ` [ruby-core:101082] " nobu
2020-11-26 17:44 ` [ruby-core:101102] " jean.boussier
2020-11-26 18:42 ` [ruby-core:101103] " jean.boussier
2020-11-26 19:02 ` [ruby-core:101104] " jean.boussier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-86578.20200717041921.7945@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).