summaryrefslogtreecommitdiffstats
path: root/ext/strscan
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
commita1fd7d2ae86fd7627d74f216c187954a9ac3824a (patch)
treea14ada29405880c7f56c615067b6600815f54334 /ext/strscan
parent4ae021c31c797c0951d8c3bb2263890c4f073369 (diff)
downloadruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.tar.gz
ruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.tar.xz
ruby-a1fd7d2ae86fd7627d74f216c187954a9ac3824a.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@10809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/strscan')
-rw-r--r--ext/strscan/strscan.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 9529bc369..f991a13ac 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -41,13 +41,13 @@ struct strscanner
#define MATCHED(s) (s)->flags |= FLAG_MATCHED
#define CLEAR_MATCH_STATUS(s) (s)->flags &= ~FLAG_MATCHED
-#define S_PBEG(s) (RSTRING((s)->str)->ptr)
-#define S_LEN(s) (RSTRING((s)->str)->len)
+#define S_PBEG(s) (RSTRING_PTR((s)->str))
+#define S_LEN(s) (RSTRING_LEN((s)->str))
#define S_PEND(s) (S_PBEG(s) + S_LEN(s))
#define CURPTR(s) (S_PBEG(s) + (s)->curr)
#define S_RESTLEN(s) (S_LEN(s) - (s)->curr)
-#define EOS_P(s) ((s)->curr >= RSTRING(p->str)->len)
+#define EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str))
#define GET_SCANNER(obj,var) do {\
Data_Get_Struct(obj, struct strscanner, var);\
@@ -1069,7 +1069,7 @@ strscan_inspect(VALUE self)
len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld @ %s>",
rb_class2name(CLASS_OF(self)),
p->curr, S_LEN(p),
- RSTRING(b)->ptr);
+ RSTRING_PTR(b));
return infect(rb_str_new(buf, len), p);
}
a = inspect1(p);
@@ -1077,8 +1077,8 @@ strscan_inspect(VALUE self)
len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld %s @ %s>",
rb_class2name(CLASS_OF(self)),
p->curr, S_LEN(p),
- RSTRING(a)->ptr,
- RSTRING(b)->ptr);
+ RSTRING_PTR(a),
+ RSTRING_PTR(b));
return infect(rb_str_new(buf, len), p);
}