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 /error.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 'error.c')
-rw-r--r-- | error.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -221,7 +221,7 @@ rb_check_type(VALUE x, int t) etype = "Symbol"; } else if (rb_special_const_p(x)) { - etype = RSTRING(rb_obj_as_string(x))->ptr; + etype = RSTRING_PTR(rb_obj_as_string(x)); } else { etype = rb_obj_classname(x); @@ -378,7 +378,7 @@ exc_inspect(VALUE exc) klass = CLASS_OF(exc); exc = rb_obj_as_string(exc); - if (RSTRING(exc)->len == 0) { + if (RSTRING_LEN(exc) == 0) { return rb_str_dup(rb_class_name(klass)); } @@ -699,10 +699,10 @@ name_err_mesg_to_str(VALUE obj) break; default: d = rb_protect(rb_inspect, obj, 0); - if (NIL_P(d) || RSTRING(d)->len > 65) { + if (NIL_P(d) || RSTRING_LEN(d) > 65) { d = rb_any_to_s(obj); } - desc = RSTRING(d)->ptr; + desc = RSTRING_PTR(d); break; } if (desc && desc[0] != '#') { @@ -745,7 +745,7 @@ rb_invalid_str(const char *str, const char *type) { VALUE s = rb_str_inspect(rb_str_new2(str)); - rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING(s)->ptr); + rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s)); } /* @@ -856,7 +856,7 @@ syserr_initialize(int argc, VALUE *argv, VALUE self) StringValue(str); mesg = rb_sprintf("%s - %.*s", err, - (int)RSTRING(str)->len, RSTRING(str)->ptr); + (int)RSTRING_LEN(str), RSTRING_PTR(str)); } else { mesg = rb_str_new2(err); |