mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
symbol.c: rb_cstr_intern
* symbol.c (rb_cstr_intern): new function to make Symbol object like as rb_str_intern() but from pointer to the name, its length and its encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bdc2876597
commit
1803427660
2 changed files with 13 additions and 0 deletions
|
@ -1129,6 +1129,11 @@ size_t rb_str_memsize(VALUE);
|
|||
VALUE rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passed_proc);
|
||||
VALUE rb_sym_to_proc(VALUE sym);
|
||||
|
||||
/* symbol.c */
|
||||
#ifdef RUBY_ENCODING_H
|
||||
VALUE rb_cstr_intern(const char *ptr, long len, rb_encoding *enc);
|
||||
#endif
|
||||
|
||||
/* struct.c */
|
||||
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
|
||||
|
||||
|
|
8
symbol.c
8
symbol.c
|
@ -1013,6 +1013,14 @@ rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_cstr_intern(const char *ptr, long len, rb_encoding *enc)
|
||||
{
|
||||
struct RString fake_str;
|
||||
const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
|
||||
return rb_str_intern(name);
|
||||
}
|
||||
|
||||
static ID
|
||||
attrsetname_to_attr_id(VALUE name)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue