[macruby-changes] [278] MacRuby/trunk/ext/strscan/strscan.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 11 16:49:21 PDT 2008
Revision: 278
http://trac.macosforge.org/projects/ruby/changeset/278
Author: lsansonetti at apple.com
Date: 2008-06-11 16:49:20 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
don't create unnecessary bytestrings
Modified Paths:
--------------
MacRuby/trunk/ext/strscan/strscan.c
Modified: MacRuby/trunk/ext/strscan/strscan.c
===================================================================
--- MacRuby/trunk/ext/strscan/strscan.c 2008-06-11 22:31:06 UTC (rev 277)
+++ MacRuby/trunk/ext/strscan/strscan.c 2008-06-11 23:49:20 UTC (rev 278)
@@ -42,13 +42,13 @@
#define MATCHED(s) (s)->flags |= FLAG_MATCHED
#define CLEAR_MATCH_STATUS(s) (s)->flags &= ~FLAG_MATCHED
-#define S_PBEG(s) (RSTRING_PTR((s)->str))
-#define S_LEN(s) (RSTRING_LEN((s)->str))
+#define S_PBEG(s) (RSTRING_CPTR((s)->str))
+#define S_LEN(s) (RSTRING_CLEN((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_LEN(p->str))
+#define EOS_P(s) ((s)->curr >= RSTRING_CLEN(p->str))
#define GET_SCANNER(obj,var) do {\
Data_Get_Struct(obj, struct strscanner, var);\
@@ -1089,7 +1089,7 @@
len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld @ %s>",
rb_class2name(CLASS_OF(self)),
p->curr, S_LEN(p),
- RSTRING_PTR(b));
+ RSTRING_CPTR(b));
return infect(rb_str_new(buf, len), p);
}
a = inspect1(p);
@@ -1097,8 +1097,8 @@
len = snprintf(buf, BUFSIZE, "#<%s %ld/%ld %s @ %s>",
rb_class2name(CLASS_OF(self)),
p->curr, S_LEN(p),
- RSTRING_PTR(a),
- RSTRING_PTR(b));
+ RSTRING_CPTR(a),
+ RSTRING_CPTR(b));
return infect(rb_str_new(buf, len), p);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080611/0e1d40df/attachment.htm
More information about the macruby-changes
mailing list