summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorbar@mysql.com <>2004-06-11 17:50:20 +0500
committerbar@mysql.com <>2004-06-11 17:50:20 +0500
commitf8b15e8bb6a87a3663d7703b40fbc7f0a1f8691a (patch)
treed6e5fc84dbea8d1d3561e08214c0a32dcc1b639f /strings
parentc64d93b27403dc9d154eb601b88d95964f9fc05b (diff)
downloadmariadb-git-f8b15e8bb6a87a3663d7703b40fbc7f0a1f8691a.tar.gz
Initialize max_sort_char only if a character set is requested.
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-gb2312.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c6
-rw-r--r--strings/ctype-simple.c28
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-ujis.c4
-rw-r--r--strings/ctype-utf8.c4
9 files changed, 44 insertions, 18 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 3d9cb92bf0d..33c686677f1 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6329,7 +6329,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_big5_handler,
&my_collation_big5_chinese_ci_handler
};
@@ -6356,7 +6356,7 @@ CHARSET_INFO my_charset_big5_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_big5_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index e739339b9e4..1e6931244d2 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -8697,7 +8697,7 @@ CHARSET_INFO my_charset_euckr_korean_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -8724,7 +8724,7 @@ CHARSET_INFO my_charset_euckr_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index aee4ed55af6..2c5aae83769 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -5748,7 +5748,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -5774,7 +5774,7 @@ CHARSET_INFO my_charset_gb2312_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index d6063e9f80f..aec23366ea5 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -9978,7 +9978,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -10004,7 +10004,7 @@ CHARSET_INFO my_charset_gbk_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 86c80ff5a66..f5e7fd8baa4 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -427,7 +427,7 @@ CHARSET_INFO my_charset_latin1=
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_8bit_simple_ci_handler
};
@@ -708,7 +708,7 @@ CHARSET_INFO my_charset_latin1_german2_ci=
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 247, /* max_sort_char */
&my_charset_handler,
&my_collation_german2_ci_handler
};
@@ -735,7 +735,7 @@ CHARSET_INFO my_charset_latin1_bin=
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_8bit_bin_handler
};
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index c28df91ae86..0d30ad28a20 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1238,6 +1238,32 @@ static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(uint))
return create_fromuni(cs, alloc);
}
+static void set_max_sort_char(CHARSET_INFO *cs)
+{
+ uchar max_char;
+ uint i;
+
+ if (!cs->sort_order)
+ return;
+
+ max_char=cs->sort_order[(uchar) cs->max_sort_char];
+ for (i= 0; i < 256; i++)
+ {
+ if ((uchar) cs->sort_order[i] > max_char)
+ {
+ max_char=(uchar) cs->sort_order[i];
+ cs->max_sort_char= i;
+ }
+ }
+}
+
+static my_bool my_coll_init_simple(CHARSET_INFO *cs,
+ void *(*alloc)(uint) __attribute__((unused)))
+{
+ set_max_sort_char(cs);
+ return FALSE;
+}
+
MY_CHARSET_HANDLER my_charset_8bit_handler=
@@ -1269,7 +1295,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler=
MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
{
- NULL, /* init */
+ my_coll_init_simple, /* init */
my_strnncoll_simple,
my_strnncollsp_simple,
my_strnxfrm_simple,
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 3744711447a..656c903c7a1 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4595,7 +4595,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -4621,7 +4621,7 @@ CHARSET_INFO my_charset_sjis_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index fb7946a6b98..7f88a16cac6 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -8484,7 +8484,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -8511,7 +8511,7 @@ CHARSET_INFO my_charset_ujis_bin=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 99ac114de9c..02918fcd10f 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2106,7 +2106,7 @@ CHARSET_INFO my_charset_utf8_general_ci=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -2133,7 +2133,7 @@ CHARSET_INFO my_charset_utf8_bin=
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
- 0, /* max_sort_char */
+ 255, /* max_sort_char */
&my_charset_handler,
&my_collation_mb_bin_handler
};