summaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:47:44 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:47:44 +0000
commit77c9830d3048f56c5ac3addfbed82d4d58a75303 (patch)
tree4509d254ff81222c7b4db1b34cbcc377c2311e54 /error.c
parenta1fd7d2ae86fd7627d74f216c187954a9ac3824a (diff)
downloadruby-77c9830d3048f56c5ac3addfbed82d4d58a75303.tar.gz
ruby-77c9830d3048f56c5ac3addfbed82d4d58a75303.tar.xz
ruby-77c9830d3048f56c5ac3addfbed82d4d58a75303.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/error.c b/error.c
index cdb1b327a..38d96ba4e 100644
--- a/error.c
+++ b/error.c
@@ -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);