mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
variable.c: rb_class_path_cached
* variable.c (rb_class_path_cached): returns cached class path only, without searching and allocating new class path string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
334294d0e2
commit
b4ab650e1a
3 changed files with 18 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Dec 9 12:25:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* variable.c (rb_class_path_cached): returns cached class path
|
||||||
|
only, without searching and allocating new class path string.
|
||||||
|
|
||||||
Mon Dec 9 11:14:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Dec 9 11:14:26 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/date/date_parse.c (parse_time): unset case-insensitive flag
|
* ext/date/date_parse.c (parse_time): unset case-insensitive flag
|
||||||
|
|
|
@ -888,6 +888,7 @@ struct timespec rb_time_timespec(VALUE time);
|
||||||
/* variable.c */
|
/* variable.c */
|
||||||
VALUE rb_mod_name(VALUE);
|
VALUE rb_mod_name(VALUE);
|
||||||
VALUE rb_class_path(VALUE);
|
VALUE rb_class_path(VALUE);
|
||||||
|
VALUE rb_class_path_cached(VALUE);
|
||||||
void rb_set_class_path(VALUE, VALUE, const char*);
|
void rb_set_class_path(VALUE, VALUE, const char*);
|
||||||
void rb_set_class_path_string(VALUE, VALUE, VALUE);
|
void rb_set_class_path_string(VALUE, VALUE, VALUE);
|
||||||
VALUE rb_path_to_class(VALUE);
|
VALUE rb_path_to_class(VALUE);
|
||||||
|
|
12
variable.c
12
variable.c
|
@ -277,6 +277,18 @@ rb_class_path_no_cache(VALUE klass)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_class_path_cached(VALUE klass)
|
||||||
|
{
|
||||||
|
st_table *ivtbl = RCLASS_IV_TBL(klass);
|
||||||
|
st_data_t n;
|
||||||
|
|
||||||
|
if (!ivtbl) return Qnil;
|
||||||
|
if (st_lookup(ivtbl, (st_data_t)classpath, &n)) return (VALUE)n;
|
||||||
|
if (st_lookup(ivtbl, (st_data_t)tmp_classpath, &n)) return (VALUE)n;
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_set_class_path_string(VALUE klass, VALUE under, VALUE name)
|
rb_set_class_path_string(VALUE klass, VALUE under, VALUE name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue