diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-24 03:50:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-24 03:50:56 +0000 |
commit | d3199656be297d33696418f8730577fd30735445 (patch) | |
tree | 536adb665fd62a02e49a032d8a2b511ef7aef376 /string.c | |
parent | 0161f79a123829c08f7e15f82d1c0d7f3a6f9265 (diff) | |
download | ruby-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.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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) { |