summaryrefslogtreecommitdiff
path: root/strings/ctype-simple.c
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-09-24 10:24:55 +0300
committerunknown <monty@narttu.mysql.fi>2003-09-24 10:24:55 +0300
commit4e09f14b18ededb18aab527abe582fca34afe79c (patch)
tree7a953ea10b82122bdf37cf7efc4cfd3fd9a20b17 /strings/ctype-simple.c
parent48869febe61d1aef3e05af6bd17bab3e27b90f6d (diff)
parent07001f78eca148d143ebf7fea66f4296a19a6d51 (diff)
downloadmariadb-git-4e09f14b18ededb18aab527abe582fca34afe79c.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into narttu.mysql.fi:/my/mysql-4.1 sql/sql_parse.cc: Auto merged
Diffstat (limited to 'strings/ctype-simple.c')
-rw-r--r--strings/ctype-simple.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index ca0097579bd..152980dd305 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1030,6 +1030,44 @@ uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)),
}
+int my_instr_simple(CHARSET_INFO *cs,
+ const char *big, uint b_length,
+ const char *small, uint s_length)
+{
+ register const uchar *str, *search, *end, *search_end;
+
+ if (s_length <= b_length)
+ {
+ if (!s_length)
+ return 0; // Empty string is always found
+
+ str= (const uchar*) big;
+ search= (const uchar*) small;
+ end= (const uchar*) big+b_length-s_length+1;
+ search_end= (const uchar*) small + s_length;
+
+skipp:
+ while (str != end)
+ {
+ if (cs->sort_order[*str++] == cs->sort_order[*search])
+ {
+ register const uchar *i,*j;
+
+ i= str;
+ j= search+1;
+
+ while (j != search_end)
+ if (cs->sort_order[*i++] != cs->sort_order[*j++])
+ goto skipp;
+
+ return (int) (str- (const uchar*)big) -1;
+ }
+ }
+ }
+ return -1;
+}
+
+
MY_CHARSET_HANDLER my_charset_8bit_handler=
{
NULL, /* ismbchar */
@@ -1063,5 +1101,6 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,
+ my_instr_simple,
my_hash_sort_simple
};