Skip to content

Commit 518f22a

Browse files
committed
[GR-36903] Add support for rb_str_new_static.
PullRequest: truffleruby/3171
2 parents b0d5098 + ea3c4c5 commit 518f22a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Compatibility:
2727
* Follow symlinks when processing `*/` directory glob patterns. (#2589, @aardvark179).
2828
* Set `@gem_prelude_index` variable on the default load paths (#2586 , @bjfish)
2929
* Do not call `IO#flush` dynamically from `IO#close` (#2594, @gogainda).
30+
* Implement `rb_str_new_static` for C extensions that use it (@aardvark179).
3031

3132
Performance:
3233

lib/cext/ABI_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11
1+
12

src/main/c/cext/string.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ VALUE rb_str_new(const char *string, long length) {
6060
}
6161
}
6262

63+
VALUE rb_str_new_static(const char *string, long length) {
64+
/* The string will be copied immediately anyway, so no real difference to rb_str_new. */
65+
return rb_str_new(string, length);
66+
}
67+
6368
VALUE rb_tainted_str_new(const char *ptr, long len) {
6469
rb_warning("rb_tainted_str_new is deprecated and will be removed in Ruby 3.2.");
6570
return rb_str_new(ptr, len);

0 commit comments

Comments
 (0)