summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
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