From 77c9830d3048f56c5ac3addfbed82d4d58a75303 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 31 Aug 2006 10:47:44 +0000 Subject: * 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 --- error.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'error.c') 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); -- cgit