diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 10:47:44 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 10:47:44 +0000 |
commit | 54af80844fbcf132f85e9275673eaa66b72da996 (patch) | |
tree | 4509d254ff81222c7b4db1b34cbcc377c2311e54 /variable.c | |
parent | 25c50cd193d89ad0737219142bab191f12b8abe8 (diff) | |
download | ruby-54af80844fbcf132f85e9275673eaa66b72da996.tar.gz |
* ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
(RSTRING_PTR): ditto.
* string.c: use RSTRING_LEN and RSTRING_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/variable.c b/variable.c index 2374e3fe70..47ef4dd54a 100644 --- a/variable.c +++ b/variable.c @@ -235,7 +235,7 @@ rb_path2class(const char *path) while (*p && *p != ':') p++; str = rb_str_new(pbeg, p-pbeg); - id = rb_intern(RSTRING(str)->ptr); + id = rb_intern(RSTRING_PTR(str)); if (p[0] == ':') { if (p[1] != ':') goto undefined_class; p += 2; @@ -273,7 +273,7 @@ rb_class_name(VALUE klass) char * rb_class2name(VALUE klass) { - return RSTRING(rb_class_name(klass))->ptr; + return RSTRING_PTR(rb_class_name(klass)); } char * @@ -1155,7 +1155,7 @@ check_autoload_table(VALUE av) Check_Type(av, T_DATA); if (RDATA(av)->dmark != (RUBY_DATA_FUNC)rb_mark_tbl || RDATA(av)->dfree != (RUBY_DATA_FUNC)st_free_table) { - rb_raise(rb_eTypeError, "wrong autoload table: %s", RSTRING(rb_inspect(av))->ptr); + rb_raise(rb_eTypeError, "wrong autoload table: %s", RSTRING_PTR(rb_inspect(av))); } return (struct st_table *)DATA_PTR(av); } @@ -1223,7 +1223,7 @@ rb_autoload_load(VALUE klass, ID id) VALUE file; NODE *load = autoload_delete(klass, id); - if (!load || !(file = load->nd_lit) || rb_provided(RSTRING(file)->ptr)) { + if (!load || !(file = load->nd_lit) || rb_provided(RSTRING_PTR(file))) { return Qfalse; } return rb_require_safe(file, load->nd_nth); @@ -1242,10 +1242,10 @@ autoload_file(VALUE mod, ID id) } file = ((NODE *)load)->nd_lit; Check_Type(file, T_STRING); - if (!RSTRING(file)->ptr) { + if (!RSTRING_PTR(file)) { rb_raise(rb_eArgError, "empty file name"); } - if (!rb_provided(RSTRING(file)->ptr)) { + if (!rb_provided(RSTRING_PTR(file))) { return file; } |