summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 03:50:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 03:50:56 +0000
commitd3199656be297d33696418f8730577fd30735445 (patch)
tree536adb665fd62a02e49a032d8a2b511ef7aef376 /string.c
parent0161f79a123829c08f7e15f82d1c0d7f3a6f9265 (diff)
downloadruby-d3199656be297d33696418f8730577fd30735445.tar.gz
string.c: rb_fstring_cstr
* string.c (rb_fstring_cstr): new function to make a fstring from a string literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/string.c b/string.c
index 4d2944ccd4..1a962153a1 100644
--- a/string.c
+++ b/string.c
@@ -46,6 +46,7 @@
#undef rb_str_buf_cat2
#undef rb_str_cat2
#undef rb_str_cat_cstr
+#undef rb_fstring_cstr
static VALUE rb_str_clear(VALUE str);
@@ -303,6 +304,12 @@ rb_fstring_new(const char *ptr, long len)
return rb_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII));
}
+VALUE
+rb_fstring_cstr(const char *ptr)
+{
+ return rb_fstring_new(ptr, strlen(ptr));
+}
+
static int
fstring_set_class_i(st_data_t key, st_data_t val, st_data_t arg)
{