summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-14 05:30:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-14 05:30:29 +0000
commitabc49e493d6c1dc47586a7d1b616df5237bd606f (patch)
treedb7b8cc8d3495baf10d4e3d9c3f899233231d629 /re.c
parent00e9a8f0c33d8c7e384041e2bcce6d28d3450bb8 (diff)
2000-06-14
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/re.c b/re.c
index 5559ce0..57bbb72 100644
--- a/re.c
+++ b/re.c
@@ -71,20 +71,27 @@ static const char casetable[] = {
#define MIN(a,b) (((a)>(b))?(b):(a))
int
-rb_str_cicmp(str1, str2)
- VALUE str1, str2;
-{
- int len, i;
+rb_memcmp(p1, p2, len)
char *p1, *p2;
+ size_t len;
+{
+ int tmp;
- len = MIN(RSTRING(str1)->len, RSTRING(str2)->len);
- p1 = RSTRING(str1)->ptr; p2 = RSTRING(str2)->ptr;
+ if (!ruby_ignorecase) {
+ return memcmp(p1, p2, len);
+ }
- for (i = 0; i < len; i++, p1++, p2++) {
- if (casetable[(unsigned)*p1] != casetable[(unsigned)*p2])
- return casetable[(unsigned)*p1] - casetable[(unsigned)*p2];
+ while (len--) {
+ if (tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++])
+ return tmp;
}
- return RSTRING(str1)->len - RSTRING(str2)->len;
+ return 0;
+}
+
+int
+rb_str_cicmp(str1, str2)
+ VALUE str1, str2;
+{
}
#define REG_CASESTATE FL_USER0