summaryrefslogtreecommitdiff
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
commit25c50cd193d89ad0737219142bab191f12b8abe8 (patch)
treea14ada29405880c7f56c615067b6600815f54334 /ext/strscan
parent22f249ebd7a142faacdf5edd7e196bd2149feae5 (diff)
* 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@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 9529bc3..f991a13 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);
}