/src/server/strings/strcoll.inl
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /*  | 
2  |  |    Copyright (c) 2015, MariaDB Foundation  | 
3  |  |    Copyright (c) 2015, 2020, MariaDB Corporation.  | 
4  |  |  | 
5  |  |    This program is free software; you can redistribute it and/or modify  | 
6  |  |    it under the terms of the GNU General Public License as published by  | 
7  |  |    the Free Software Foundation; version 2 of the License.  | 
8  |  |  | 
9  |  |    This program is distributed in the hope that it will be useful,  | 
10  |  |    but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
11  |  |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  | 
12  |  |    GNU General Public License for more details.  | 
13  |  |  | 
14  |  |    You should have received a copy of the GNU General Public License  | 
15  |  |    along with this program; if not, write to the Free Software  | 
16  |  |    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA  | 
17  |  | */  | 
18  |  |  | 
19  |  | #include "ctype-ascii.h"  | 
20  |  |  | 
21  |  | #ifndef MY_FUNCTION_NAME  | 
22  |  | #error MY_FUNCTION_NAME is not defined  | 
23  |  | #endif  | 
24  |  |  | 
25  |  | /*  | 
26  |  |   Define strnncoll() and strnncollsp() by default,  | 
27  |  |   unless "#define DEFINE_STRNNCOLL 0" is specified.  | 
28  |  | */  | 
29  |  | #ifndef DEFINE_STRNNCOLL  | 
30  |  | #define DEFINE_STRNNCOLL 1  | 
31  |  | #endif  | 
32  |  |  | 
33  |  |  | 
34  |  | /*  | 
35  |  |   The weight for automatically padded spaces when comparing strings with  | 
36  |  |   the PAD SPACE property.  | 
37  |  |   Should normally be equal to the weight of a regular space.  | 
38  |  | */  | 
39  |  | #ifndef WEIGHT_PAD_SPACE  | 
40  | 0  | #define WEIGHT_PAD_SPACE  (' ') | 
41  |  | #endif  | 
42  |  |  | 
43  |  |  | 
44  |  | /*  | 
45  |  |   For binary collations:  | 
46  |  |   - on 32bit platforms perform only 4 byte optimization  | 
47  |  |   - on 64bit platforms perform both 4 byte and 8 byte optimization  | 
48  |  | */  | 
49  |  | #if defined(STRCOLL_MB7_BIN)  | 
50  | 0  | #define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_mb7_bin_4bytes((a),(b))  | 
51  |  | #if SIZEOF_VOIDP == 8  | 
52  |  | #define STRCOLL_MB7_8BYTES  | 
53  | 0  | #define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_mb7_bin_8bytes((a),(b))  | 
54  |  | #endif /* Architecture test */  | 
55  |  | #endif /* STRCOLL_MB7_BIN */  | 
56  |  |  | 
57  |  |  | 
58  |  | /*  | 
59  |  |   For case insensitive collations with trivial mapping from [a-z] to [A-Z]  | 
60  |  |   perform optimization only on 64 bit platforms.  | 
61  |  |   There is no sense to perform my_ascii_to_upper_magic_uint64() based  | 
62  |  |   optimization on 32bit platforms. The idea of this optimization  | 
63  |  |   is that it handles 8bytes at a time, using 64bit CPU registers.  | 
64  |  |   Enabling this optimization on 32bit platform may only slow things down.  | 
65  |  | */  | 
66  |  | #if defined(STRCOLL_MB7_TOUPPER)  | 
67  |  | #if SIZEOF_VOIDP == 8  | 
68  | 0  | #define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_ascii_toupper_4bytes((a),(b))  | 
69  | 0  | #define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_ascii_toupper_8bytes((a),(b))  | 
70  |  | #endif /* Architecture test */  | 
71  |  | #endif /* STRCOLL_MB7_TOUPPER */  | 
72  |  |  | 
73  |  |  | 
74  |  | /*  | 
75  |  |   A helper macro to shift two pointers forward, to the given amount.  | 
76  |  | */  | 
77  | 0  | #define MY_STRING_SHIFT_PTR_PTR(a,b,len) do { a+= len; b+= len; } while(0) | 
78  |  |  | 
79  |  |  | 
80  |  | /*  | 
81  |  |   Weight of an illegal byte, must follow these rules:  | 
82  |  |   1. Must be greater than weight of any normal character in the collation.  | 
83  |  |   2. Two different bad bytes must have different weights and must be  | 
84  |  |      compared in their binary order.  | 
85  |  |  | 
86  |  |   Depends on mbmaxlen of the character set, as well as how the collation  | 
87  |  |   sorts various single-byte and multi-byte character blocks.  | 
88  |  |  | 
89  |  |   The macro below is the default definition, it is suitable for mbmaxlen=2  | 
90  |  |   character sets that sort all multi-byte characters after all single-byte  | 
91  |  |   characters: big5, euckr, gb2312, gbk.  | 
92  |  |  | 
93  |  |   All mbmaxlen>2 character sets must provide their own definitions.  | 
94  |  |   All collations that have a more complex order (than just MB1 followed by MB2)  | 
95  |  |   must also provide their own definitions (see definitions for  | 
96  |  |   cp932_japanese_ci and sjis_japanese_ci as examples of a more complex order).  | 
97  |  | */  | 
98  |  | #ifndef WEIGHT_ILSEQ  | 
99  | 0  | #define WEIGHT_ILSEQ(x)   (0xFF00 + (x))  | 
100  |  | #endif  | 
101  |  |  | 
102  |  |  | 
103  |  | #if defined(WEIGHT_SIZE) && WEIGHT_SIZE == 3  | 
104  | 0  | #define PUT_WC_BE_HAVE_1BYTE(dst, de, wc) PUT_WC_BE3_HAVE_1BYTE((dst), (de), (wc))  | 
105  | 0  | #define PAD_NWEIGHTS_UNICODE_BE(str, end, n)  my_strxfrm_pad_nweights_unicode_be3(str, end, n)  | 
106  | 0  | #define PAD_UNICODE_BE(str, end)  my_strxfrm_pad_unicode_be3(str, end)  | 
107  |  | #else  | 
108  | 0  | #define PUT_WC_BE_HAVE_1BYTE(dst, de, wc) PUT_WC_BE2_HAVE_1BYTE((dst), (de), (wc))  | 
109  | 0  | #define PAD_NWEIGHTS_UNICODE_BE(str, end, n)  my_strxfrm_pad_nweights_unicode_be2(str, end, n)  | 
110  | 0  | #define PAD_UNICODE_BE(str, end)  my_strxfrm_pad_unicode_be2(str, end)  | 
111  |  | #endif  | 
112  |  |  | 
113  |  |  | 
114  |  | #if DEFINE_STRNNCOLL  | 
115  |  |  | 
116  |  | /**  | 
117  |  |   Scan a valid character, or a bad byte, or an auto-padded space  | 
118  |  |   from a string and calculate the weight of the scanned sequence.  | 
119  |  |  | 
120  |  |   @param [OUT] weight - the weight is returned here  | 
121  |  |   @param str          - the string  | 
122  |  |   @param end          - the end of the string  | 
123  |  |   @return             - the number of bytes scanned  | 
124  |  |  | 
125  |  |   The including source file must define the following macros:  | 
126  |  |   IS_MB1_CHAR(b0)          - for character sets that have MB1 characters  | 
127  |  |   IS_MB1_MB2HEAD_GAP(b0)   - optional, for better performance  | 
128  |  |   IS_MB2_CHAR(b0,b1)       - for character sets that have MB2 characters  | 
129  |  |   IS_MB3_CHAR(b0,b1,b2)    - for character sets that have MB3 characters  | 
130  |  |   IS_MB4_CHAR(b0,b1,b2,b3) - for character sets with have MB4 characters  | 
131  |  |   WEIGHT_PAD_SPACE  | 
132  |  |   WEIGHT_MB1(b0)           - for character sets that have MB1 characters  | 
133  |  |   WEIGHT_MB2(b0,b1)        - for character sets that have MB2 characters  | 
134  |  |   WEIGHT_MB3(b0,b1,b2)     - for character sets that have MB3 characters  | 
135  |  |   WEIGHT_MB4(b0,b1,b2,b3)  - for character sets that have MB4 characters  | 
136  |  |   WEIGHT_ILSEQ(x)  | 
137  |  | */  | 
138  |  | static inline uint  | 
139  |  | MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end)  | 
140  | 0  | { | 
141  | 0  |   if (str >= end)  | 
142  | 0  |   { | 
143  | 0  |     *weight= WEIGHT_PAD_SPACE;  | 
144  | 0  |     return 0;  | 
145  | 0  |   }  | 
146  |  |  | 
147  |  | #ifdef IS_MB1_CHAR  | 
148  | 0  |   if (IS_MB1_CHAR(*str))  | 
149  | 0  |   { | 
150  | 0  |     *weight= WEIGHT_MB1(*str);           /* A valid single byte character*/  | 
151  | 0  |     return 1;  | 
152  | 0  |   }  | 
153  | 0  | #endif  | 
154  |  |  | 
155  |  | #ifdef IS_MB1_MBHEAD_UNUSED_GAP  | 
156  |  |   /*  | 
157  |  |     Quickly filter out unused bytes that are neither MB1 nor MBHEAD.  | 
158  |  |     E.g. [0x80..0xC1] in utf8mb(3|4). This allows using simplified conditions  | 
159  |  |     in IS_MB2_CHAR(), IS_MB3_CHAR(), etc.  | 
160  |  |   */  | 
161  | 0  |   if (IS_MB1_MBHEAD_UNUSED_GAP(*str))  | 
162  | 0  |     goto bad;  | 
163  | 0  | #endif  | 
164  |  |  | 
165  |  | #ifdef IS_MB2_CHAR  | 
166  | 0  |   if (str + 2 > end)                     /* The string ended unexpectedly */  | 
167  | 0  |     goto bad;                            /* Treat as a bad byte */  | 
168  |  |  | 
169  | 0  |   if (IS_MB2_CHAR(str[0], str[1]))  | 
170  | 0  |   { | 
171  | 0  |     *weight= WEIGHT_MB2(str[0], str[1]);  | 
172  | 0  |     return 2;                            /* A valid two-byte character */  | 
173  | 0  |   }  | 
174  | 0  | #endif  | 
175  |  |  | 
176  |  | #ifdef IS_MB3_CHAR  | 
177  | 0  |   if (str + 3 > end)                     /* Incomplete three-byte character */  | 
178  | 0  |     goto bad;  | 
179  |  |  | 
180  | 0  |   if (IS_MB3_CHAR(str[0], str[1], str[2]))  | 
181  | 0  |   { | 
182  | 0  |     *weight= WEIGHT_MB3(str[0], str[1], str[2]);  | 
183  | 0  |     return 3;                            /* A valid three-byte character */  | 
184  | 0  |   }  | 
185  | 0  | #endif  | 
186  |  |  | 
187  |  | #ifdef IS_MB4_CHAR  | 
188  | 0  |   if (str + 4 > end)                     /* Incomplete four-byte character */  | 
189  | 0  |     goto bad;  | 
190  |  |  | 
191  | 0  |   if (IS_MB4_CHAR(str[0], str[1], str[2], str[3]))  | 
192  | 0  |   { | 
193  | 0  |     *weight= WEIGHT_MB4(str[0], str[1], str[2], str[3]);  | 
194  | 0  |     return 4;                            /* A valid four-byte character */  | 
195  | 0  |   }  | 
196  |  |  | 
197  | 0  | #endif  | 
198  |  |  | 
199  | 0  | bad:  | 
200  | 0  |   *weight= WEIGHT_ILSEQ(str[0]);         /* Bad byte */  | 
201  | 0  |   return 1;  | 
202  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16le_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16le_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf16le_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf32_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf32_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_utf32_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_ucs2_bin Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_ucs2_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_scan_weight_ucs2_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_bin Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb3_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb4_bin Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb4_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb4_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_scan_weight_utf8mb4_general1400_as_ci Unexecuted instantiation: ctype-big5.c:my_scan_weight_big5_chinese_ci Unexecuted instantiation: ctype-big5.c:my_scan_weight_big5_bin Unexecuted instantiation: ctype-big5.c:my_scan_weight_big5_chinese_nopad_ci Unexecuted instantiation: ctype-big5.c:my_scan_weight_big5_nopad_bin Unexecuted instantiation: ctype-cp932.c:my_scan_weight_cp932_japanese_ci Unexecuted instantiation: ctype-cp932.c:my_scan_weight_cp932_bin Unexecuted instantiation: ctype-cp932.c:my_scan_weight_cp932_japanese_nopad_ci Unexecuted instantiation: ctype-cp932.c:my_scan_weight_cp932_nopad_bin Unexecuted instantiation: ctype-euc_kr.c:my_scan_weight_euckr_korean_ci Unexecuted instantiation: ctype-euc_kr.c:my_scan_weight_euckr_bin Unexecuted instantiation: ctype-euc_kr.c:my_scan_weight_euckr_korean_nopad_ci Unexecuted instantiation: ctype-euc_kr.c:my_scan_weight_euckr_nopad_bin Unexecuted instantiation: ctype-eucjpms.c:my_scan_weight_eucjpms_japanese_ci Unexecuted instantiation: ctype-eucjpms.c:my_scan_weight_eucjpms_bin Unexecuted instantiation: ctype-eucjpms.c:my_scan_weight_eucjpms_japanese_nopad_ci Unexecuted instantiation: ctype-eucjpms.c:my_scan_weight_eucjpms_nopad_bin Unexecuted instantiation: ctype-gb2312.c:my_scan_weight_gb2312_chinese_ci Unexecuted instantiation: ctype-gb2312.c:my_scan_weight_gb2312_bin Unexecuted instantiation: ctype-gb2312.c:my_scan_weight_gb2312_chinese_nopad_ci Unexecuted instantiation: ctype-gb2312.c:my_scan_weight_gb2312_nopad_bin Unexecuted instantiation: ctype-gbk.c:my_scan_weight_gbk_chinese_ci Unexecuted instantiation: ctype-gbk.c:my_scan_weight_gbk_bin Unexecuted instantiation: ctype-gbk.c:my_scan_weight_gbk_chinese_nopad_ci Unexecuted instantiation: ctype-gbk.c:my_scan_weight_gbk_nopad_bin Unexecuted instantiation: ctype-sjis.c:my_scan_weight_sjis_japanese_ci Unexecuted instantiation: ctype-sjis.c:my_scan_weight_sjis_bin Unexecuted instantiation: ctype-sjis.c:my_scan_weight_sjis_japanese_nopad_ci Unexecuted instantiation: ctype-sjis.c:my_scan_weight_sjis_nopad_bin Unexecuted instantiation: ctype-ujis.c:my_scan_weight_ujis_japanese_ci Unexecuted instantiation: ctype-ujis.c:my_scan_weight_ujis_bin Unexecuted instantiation: ctype-ujis.c:my_scan_weight_ujis_japanese_nopad_ci Unexecuted instantiation: ctype-ujis.c:my_scan_weight_ujis_nopad_bin  | 
203  |  |  | 
204  |  |  | 
205  |  | /**  | 
206  |  |   Compare two strings according to the collation,  | 
207  |  |   without handling the PAD SPACE property.  | 
208  |  |  | 
209  |  |   Note, strnncoll() is usually used to compare identifiers.  | 
210  |  |   Perhaps we should eventually (in 10.2?) create a new collation   | 
211  |  |   my_charset_utf8mb3_general_ci_no_pad and have only one comparison function  | 
212  |  |   in MY_COLLATION_HANDLER.  | 
213  |  |  | 
214  |  |   @param cs          - the character set and collation  | 
215  |  |   @param a           - the left string  | 
216  |  |   @param a_length    - the length of the left string  | 
217  |  |   @param b           - the right string  | 
218  |  |   @param b_length    - the length of the right string  | 
219  |  |   @param b_is_prefix - if the caller wants to check if "b" is a prefix of "a"  | 
220  |  |   @return            - the comparison result  | 
221  |  | */  | 
222  |  | static int  | 
223  |  | MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),  | 
224  |  |                             const uchar *a, size_t a_length,   | 
225  |  |                             const uchar *b, size_t b_length,  | 
226  |  |                             my_bool b_is_prefix)  | 
227  | 0  | { | 
228  | 0  |   const uchar *a_end= a + a_length;  | 
229  | 0  |   const uchar *b_end= b + b_length;  | 
230  | 0  |   for ( ; ; )  | 
231  | 0  |   { | 
232  | 0  |     int a_weight, b_weight, res;  | 
233  | 0  |     uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);  | 
234  | 0  |     uint b_wlen;  | 
235  |  | 
  | 
236  |  | #ifdef MY_STRCOLL_MB7_4BYTES  | 
237  | 0  |     if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))  | 
238  | 0  |     { | 
239  | 0  |       int res;  | 
240  | 0  | #ifdef MY_STRCOLL_MB7_8BYTES  | 
241  |  |       /*TODO: a a loop here >='a' <='z' here, for automatic vectorization*/  | 
242  | 0  |       if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))  | 
243  | 0  |       { | 
244  | 0  |         if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))  | 
245  | 0  |           return res;  | 
246  | 0  |         MY_STRING_SHIFT_PTR_PTR(a, b, 8);  | 
247  | 0  |         continue;  | 
248  | 0  |       }  | 
249  | 0  | #endif  | 
250  | 0  |       if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))  | 
251  | 0  |         return res;  | 
252  | 0  |       MY_STRING_SHIFT_PTR_PTR(a, b, 4);  | 
253  | 0  |       continue;  | 
254  | 0  |     }  | 
255  | 0  | #endif /* MY_STRCOLL_MB7_4BYTES */  | 
256  |  |  | 
257  | 0  |     b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);  | 
258  |  |  | 
259  |  |     /*  | 
260  |  |       a_wlen  b_wlen Comment  | 
261  |  |       ------  ------ -------  | 
262  |  |       0       0      Strings ended simultaneously, "a" and "b" are equal.  | 
263  |  |       0       >0     "a" is a prefix of "b", so "a" is smaller.  | 
264  |  |       >0      0      "b" is a prefix of "a", check b_is_prefix.  | 
265  |  |       >0      >0     Two weights were scanned, check weight difference.  | 
266  |  |     */  | 
267  | 0  |     if (!a_wlen)  | 
268  | 0  |       return b_wlen ? -1 : 0;  | 
269  |  |  | 
270  | 0  |     if (!b_wlen)  | 
271  | 0  |       return b_is_prefix ? 0 : +1;  | 
272  |  |  | 
273  | 0  |     if ((res= (a_weight - b_weight)))  | 
274  | 0  |       return res;  | 
275  |  |     /*  | 
276  |  |       None of the strings has ended yet.  | 
277  |  |     */  | 
278  | 0  |     DBUG_ASSERT(a < a_end);  | 
279  | 0  |     DBUG_ASSERT(b < b_end);  | 
280  | 0  |     a+= a_wlen;  | 
281  | 0  |     b+= b_wlen;  | 
282  | 0  |   }  | 
283  | 0  |   DBUG_ASSERT(0);  | 
284  | 0  |   return 0;  | 
285  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16le_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16le_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf16le_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf32_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf32_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_utf32_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_ucs2_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_ucs2_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncoll_ucs2_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_bin Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb3_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb4_bin Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb4_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb4_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncoll_utf8mb4_general1400_as_ci Unexecuted instantiation: ctype-big5.c:my_strnncoll_big5_chinese_ci Unexecuted instantiation: ctype-big5.c:my_strnncoll_big5_bin Unexecuted instantiation: ctype-big5.c:my_strnncoll_big5_chinese_nopad_ci Unexecuted instantiation: ctype-big5.c:my_strnncoll_big5_nopad_bin Unexecuted instantiation: ctype-cp932.c:my_strnncoll_cp932_japanese_ci Unexecuted instantiation: ctype-cp932.c:my_strnncoll_cp932_bin Unexecuted instantiation: ctype-cp932.c:my_strnncoll_cp932_japanese_nopad_ci Unexecuted instantiation: ctype-cp932.c:my_strnncoll_cp932_nopad_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncoll_euckr_korean_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncoll_euckr_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncoll_euckr_korean_nopad_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncoll_euckr_nopad_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncoll_eucjpms_japanese_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncoll_eucjpms_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncoll_eucjpms_japanese_nopad_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncoll_eucjpms_nopad_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncoll_gb2312_chinese_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncoll_gb2312_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncoll_gb2312_chinese_nopad_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncoll_gb2312_nopad_bin Unexecuted instantiation: ctype-gbk.c:my_strnncoll_gbk_chinese_ci Unexecuted instantiation: ctype-gbk.c:my_strnncoll_gbk_bin Unexecuted instantiation: ctype-gbk.c:my_strnncoll_gbk_chinese_nopad_ci Unexecuted instantiation: ctype-gbk.c:my_strnncoll_gbk_nopad_bin Unexecuted instantiation: ctype-sjis.c:my_strnncoll_sjis_japanese_ci Unexecuted instantiation: ctype-sjis.c:my_strnncoll_sjis_bin Unexecuted instantiation: ctype-sjis.c:my_strnncoll_sjis_japanese_nopad_ci Unexecuted instantiation: ctype-sjis.c:my_strnncoll_sjis_nopad_bin Unexecuted instantiation: ctype-ujis.c:my_strnncoll_ujis_japanese_ci Unexecuted instantiation: ctype-ujis.c:my_strnncoll_ujis_bin Unexecuted instantiation: ctype-ujis.c:my_strnncoll_ujis_japanese_nopad_ci Unexecuted instantiation: ctype-ujis.c:my_strnncoll_ujis_nopad_bin  | 
286  |  |  | 
287  |  |  | 
288  |  | #ifdef DEFINE_STRNNCOLLSP_NOPAD  | 
289  |  |  | 
290  |  | /**  | 
291  |  |   Compare two strings according to the collation, with NO PAD handling.  | 
292  |  |  | 
293  |  |   @param cs          - the character set and collation  | 
294  |  |   @param a           - the left string  | 
295  |  |   @param a_length    - the length of the left string  | 
296  |  |   @param b           - the right string  | 
297  |  |   @param b_length    - the length of the right string  | 
298  |  |   @return            - the comparison result  | 
299  |  | */  | 
300  |  | static int  | 
301  |  | MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),  | 
302  |  |                                     const uchar *a, size_t a_length,  | 
303  |  |                                     const uchar *b, size_t b_length)  | 
304  | 0  | { | 
305  | 0  |   return MY_FUNCTION_NAME(strnncoll)(cs, a, a_length, b, b_length, FALSE);  | 
306  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16le_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16le_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf32_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf32_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_ucs2_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_ucs2_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb4_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb4_nopad_bin Unexecuted instantiation: ctype-big5.c:my_strnncollsp_big5_chinese_nopad_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_big5_nopad_bin Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_cp932_japanese_nopad_ci Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_cp932_nopad_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_euckr_korean_nopad_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_euckr_nopad_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_eucjpms_japanese_nopad_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_eucjpms_nopad_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_gb2312_chinese_nopad_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_gb2312_nopad_bin Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_gbk_chinese_nopad_ci Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_gbk_nopad_bin Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_sjis_japanese_nopad_ci Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_sjis_nopad_bin Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_ujis_japanese_nopad_ci Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_ujis_nopad_bin  | 
307  |  | #else  | 
308  |  | /**  | 
309  |  |   Compare two strings according to the collation, with PAD SPACE handling.  | 
310  |  |  | 
311  |  |   @param cs          - the character set and collation  | 
312  |  |   @param a           - the left string  | 
313  |  |   @param a_length    - the length of the left string  | 
314  |  |   @param b           - the right string  | 
315  |  |   @param b_length    - the length of the right string  | 
316  |  |   @return            - the comparison result  | 
317  |  | */  | 
318  |  | static int  | 
319  |  | MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),  | 
320  |  |                               const uchar *a, size_t a_length,   | 
321  |  |                               const uchar *b, size_t b_length)  | 
322  | 0  | { | 
323  | 0  |   const uchar *a_end= a + a_length;  | 
324  | 0  |   const uchar *b_end= b + b_length;  | 
325  | 0  |   for ( ; ; )  | 
326  | 0  |   { | 
327  | 0  |     int a_weight, b_weight, res;  | 
328  | 0  |     uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);  | 
329  | 0  |     uint b_wlen;  | 
330  |  | 
  | 
331  |  | #ifdef MY_STRCOLL_MB7_4BYTES  | 
332  | 0  |     if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))  | 
333  | 0  |     { | 
334  | 0  |       int res;  | 
335  | 0  | #ifdef MY_STRCOLL_MB7_8BYTES  | 
336  | 0  |       if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))  | 
337  | 0  |       { | 
338  | 0  |         if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))  | 
339  | 0  |           return res;  | 
340  | 0  |         MY_STRING_SHIFT_PTR_PTR(a, b, 8);  | 
341  | 0  |         continue;  | 
342  | 0  |       }  | 
343  | 0  | #endif  | 
344  | 0  |       if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))  | 
345  | 0  |         return res;  | 
346  | 0  |       MY_STRING_SHIFT_PTR_PTR(a, b, 4);  | 
347  | 0  |       continue;  | 
348  | 0  |     }  | 
349  | 0  | #endif /* MY_STRCOLL_MB7_4BYTES */  | 
350  |  |  | 
351  | 0  |     b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);  | 
352  |  | 
  | 
353  | 0  |     if ((res= (a_weight - b_weight)))  | 
354  | 0  |     { | 
355  |  |       /*  | 
356  |  |         Got two different weights. Each weight can be generated by either of:  | 
357  |  |         - a real character  | 
358  |  |         - a bad byte sequence or an incomplete byte sequence  | 
359  |  |         - an auto-generated trailing space (PAD SPACE)  | 
360  |  |         It does not matter how exactly each weight was generated.  | 
361  |  |         Just return the weight difference.  | 
362  |  |       */  | 
363  | 0  |       return res;  | 
364  | 0  |     }  | 
365  | 0  |     if (!a_wlen && !b_wlen)  | 
366  | 0  |     { | 
367  |  |       /*  | 
368  |  |         Got two auto-generated trailing spaces, i.e.  | 
369  |  |         both strings have now ended, so they are equal.  | 
370  |  |       */  | 
371  | 0  |       DBUG_ASSERT(a == a_end);  | 
372  | 0  |       DBUG_ASSERT(b == b_end);  | 
373  | 0  |       return 0;  | 
374  | 0  |     }  | 
375  |  |     /*  | 
376  |  |       At least one of the strings has not ended yet, continue comparison.  | 
377  |  |     */  | 
378  | 0  |     DBUG_ASSERT(a < a_end || b < b_end);  | 
379  | 0  |     a+= a_wlen;  | 
380  | 0  |     b+= b_wlen;  | 
381  | 0  |   }  | 
382  | 0  |   DBUG_ASSERT(0);  | 
383  | 0  |   return 0;  | 
384  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf16le_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_utf32_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_ucs2_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb3_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb4_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_utf8mb4_general1400_as_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_big5_chinese_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_big5_bin Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_cp932_japanese_ci Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_cp932_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_euckr_korean_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_euckr_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_eucjpms_japanese_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_eucjpms_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_gb2312_chinese_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_gb2312_bin Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_gbk_chinese_ci Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_gbk_bin Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_sjis_japanese_ci Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_sjis_bin Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_ujis_japanese_ci Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_ujis_bin  | 
385  |  | #endif /* DEFINE_STRNNCOLLSP_NOPAD */  | 
386  |  |  | 
387  |  |  | 
388  |  | /**  | 
389  |  |   Compare two strings according to the collation,  | 
390  |  |   with trailing space padding or trimming, according to "nchars".  | 
391  |  |  | 
392  |  |   @param cs          - the character set and collation  | 
393  |  |   @param a           - the left string  | 
394  |  |   @param a_length    - the length of the left string  | 
395  |  |   @param b           - the right string  | 
396  |  |   @param b_length    - the length of the right string  | 
397  |  |   @param nchars      - compare this amount of characters only  | 
398  |  |   @return            - the comparison result  | 
399  |  | */  | 
400  |  | static int  | 
401  |  | MY_FUNCTION_NAME(strnncollsp_nchars)(CHARSET_INFO *cs __attribute__((unused)),  | 
402  |  |                                      const uchar *a, size_t a_length,  | 
403  |  |                                      const uchar *b, size_t b_length,  | 
404  |  |                                      size_t nchars,  | 
405  |  |                                      uint flags)  | 
406  | 0  | { | 
407  | 0  |   const uchar *a_end= a + a_length;  | 
408  | 0  |   const uchar *b_end= b + b_length;  | 
409  | 0  |   for ( ; nchars ; nchars--)  | 
410  | 0  |   { | 
411  | 0  |     int a_weight, b_weight, res;  | 
412  | 0  |     uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);  | 
413  | 0  |     uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);  | 
414  |  | 
  | 
415  | 0  |     if ((res= (a_weight - b_weight)))  | 
416  | 0  |     { | 
417  |  |       /* Got two different weights. See comments in strnncollsp above. */  | 
418  | 0  |       return res;  | 
419  | 0  |     }  | 
420  | 0  |     if (!a_wlen && !b_wlen)  | 
421  | 0  |     { | 
422  |  |       /* Got two auto-generated trailing spaces. */  | 
423  | 0  |       DBUG_ASSERT(a == a_end);  | 
424  | 0  |       DBUG_ASSERT(b == b_end);  | 
425  | 0  |       return 0;  | 
426  | 0  |     }  | 
427  |  |     /*  | 
428  |  |       At least one of the strings has not ended yet, continue comparison.  | 
429  |  |     */  | 
430  | 0  |     DBUG_ASSERT(a < a_end || b < b_end);  | 
431  | 0  |     a+= a_wlen;  | 
432  | 0  |     b+= b_wlen;  | 
433  | 0  |   }  | 
434  | 0  |   return 0;  | 
435  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16le_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16le_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf16le_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf32_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf32_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_utf32_nopad_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_ucs2_bin Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_ucs2_general_nopad_ci Unexecuted instantiation: ctype-ucs2.c:my_strnncollsp_nchars_ucs2_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb3_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb4_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb4_general_nopad_ci Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb4_nopad_bin Unexecuted instantiation: ctype-utf8.c:my_strnncollsp_nchars_utf8mb4_general1400_as_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_nchars_big5_chinese_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_nchars_big5_bin Unexecuted instantiation: ctype-big5.c:my_strnncollsp_nchars_big5_chinese_nopad_ci Unexecuted instantiation: ctype-big5.c:my_strnncollsp_nchars_big5_nopad_bin Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_nchars_cp932_japanese_ci Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_nchars_cp932_bin Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_nchars_cp932_japanese_nopad_ci Unexecuted instantiation: ctype-cp932.c:my_strnncollsp_nchars_cp932_nopad_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_nchars_euckr_korean_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_nchars_euckr_bin Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_nchars_euckr_korean_nopad_ci Unexecuted instantiation: ctype-euc_kr.c:my_strnncollsp_nchars_euckr_nopad_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_nchars_eucjpms_japanese_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_nchars_eucjpms_bin Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_nchars_eucjpms_japanese_nopad_ci Unexecuted instantiation: ctype-eucjpms.c:my_strnncollsp_nchars_eucjpms_nopad_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_nchars_gb2312_chinese_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_nchars_gb2312_bin Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_nchars_gb2312_chinese_nopad_ci Unexecuted instantiation: ctype-gb2312.c:my_strnncollsp_nchars_gb2312_nopad_bin Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_nchars_gbk_chinese_ci Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_nchars_gbk_bin Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_nchars_gbk_chinese_nopad_ci Unexecuted instantiation: ctype-gbk.c:my_strnncollsp_nchars_gbk_nopad_bin Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_nchars_sjis_japanese_ci Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_nchars_sjis_bin Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_nchars_sjis_japanese_nopad_ci Unexecuted instantiation: ctype-sjis.c:my_strnncollsp_nchars_sjis_nopad_bin Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_nchars_ujis_japanese_ci Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_nchars_ujis_bin Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_nchars_ujis_japanese_nopad_ci Unexecuted instantiation: ctype-ujis.c:my_strnncollsp_nchars_ujis_nopad_bin  | 
436  |  |  | 
437  |  |  | 
438  |  | #endif /* DEFINE_STRNNCOLL */  | 
439  |  |  | 
440  |  |  | 
441  |  | #ifdef DEFINE_STRNXFRM  | 
442  |  | #ifndef WEIGHT_MB2_FRM  | 
443  | 0  | #define WEIGHT_MB2_FRM(x,y)  WEIGHT_MB2(x,y)  | 
444  |  | #endif  | 
445  |  |  | 
446  |  | static size_t  | 
447  |  | MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs,  | 
448  |  |                            uchar *dst, size_t dstlen, uint nweights,  | 
449  |  |                            const uchar *src, size_t srclen, uint flags)  | 
450  | 0  | { | 
451  | 0  |   uchar *d0= dst;  | 
452  | 0  |   uchar *de= dst + dstlen;  | 
453  | 0  |   const uchar *se= src + srclen;  | 
454  | 0  |   const uchar *sort_order= cs->sort_order;  | 
455  |  | 
  | 
456  | 0  |   for (; dst < de && src < se && nweights; nweights--)  | 
457  | 0  |   { | 
458  | 0  |     if (my_ci_charlen(cs, src, se) > 1)  | 
459  | 0  |     { | 
460  |  |       /*  | 
461  |  |         Note, it is safe not to check (src < se)  | 
462  |  |         in the code below, because my_ci_charlen() would  | 
463  |  |         not return 2 if src was too short  | 
464  |  |       */  | 
465  | 0  |       uint16 e= WEIGHT_MB2_FRM(src[0], src[1]);  | 
466  | 0  |       *dst++= (uchar) (e >> 8);  | 
467  | 0  |       if (dst < de)  | 
468  | 0  |         *dst++= (uchar) (e & 0xFF);  | 
469  | 0  |       src+= 2;  | 
470  | 0  |     }  | 
471  | 0  |     else  | 
472  | 0  |       *dst++= sort_order ? sort_order[*src++] : *src++;  | 
473  | 0  |   }  | 
474  |  | #ifdef DEFINE_STRNNCOLLSP_NOPAD  | 
475  |  |   return my_strxfrm_pad_desc_and_reverse_nopad(cs, d0, dst, de,  | 
476  |  |                  nweights, flags, 0);  | 
477  |  | #else  | 
478  |  |   return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0);  | 
479  |  | #endif  | 
480  | 0  | } Unexecuted instantiation: ctype-big5.c:my_strnxfrm_big5_chinese_ci Unexecuted instantiation: ctype-big5.c:my_strnxfrm_big5_chinese_nopad_ci Unexecuted instantiation: ctype-gbk.c:my_strnxfrm_gbk_chinese_ci Unexecuted instantiation: ctype-gbk.c:my_strnxfrm_gbk_chinese_nopad_ci  | 
481  |  | #endif /* DEFINE_STRNXFRM */  | 
482  |  |  | 
483  |  |  | 
484  |  | #if defined(DEFINE_STRNXFRM_UNICODE) || defined(DEFINE_STRNXFRM_UNICODE_NOPAD)  | 
485  |  |  | 
486  |  | /*  | 
487  |  |   Store sorting weights using 2 bytes per character.  | 
488  |  |  | 
489  |  |   This function is shared between  | 
490  |  |   - utf8mb3_general_ci, utf8mb3_bin, ucs2_general_ci, ucs2_bin  | 
491  |  |     which support BMP only (U+0000..U+FFFF).  | 
492  |  |   - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci,  | 
493  |  |     which map all supplementary characters to weight 0xFFFD.  | 
494  |  | */  | 
495  |  |  | 
496  |  | #ifndef MY_MB_WC  | 
497  |  | #error MY_MB_WC must be defined for DEFINE_STRNXFRM_UNICODE  | 
498  |  | #endif  | 
499  |  |  | 
500  |  | #ifndef OPTIMIZE_ASCII  | 
501  |  | #error OPTIMIZE_ASCII must be defined for DEFINE_STRNXFRM_UNICODE  | 
502  |  | #endif  | 
503  |  |  | 
504  |  | #if OPTIMIZE_ASCII && !defined(WEIGHT_MB1)  | 
505  |  | #error WEIGHT_MB1 must be defined for DEFINE_STRNXFRM_UNICODE  | 
506  |  | #endif  | 
507  |  |  | 
508  |  | #ifndef MY_WC_WEIGHT  | 
509  |  | #error MY_WC_WEIGHT must be defined for DEFINE_STRNXFRM_UNICODE  | 
510  |  | #endif  | 
511  |  |  | 
512  |  | static size_t  | 
513  |  | MY_FUNCTION_NAME(strnxfrm_internal)(CHARSET_INFO *cs __attribute__((unused)),  | 
514  |  |                                     uchar *dst, uchar *de,  | 
515  |  |                                     uint *nweights,  | 
516  |  |                                     const uchar *src, const uchar *se)  | 
517  | 0  | { | 
518  | 0  |   my_wc_t UNINIT_VAR(wc);  | 
519  | 0  |   uchar *dst0= dst;  | 
520  |  | 
  | 
521  | 0  |   DBUG_ASSERT(src || !se);  | 
522  | 0  |   DBUG_ASSERT((cs->state & MY_CS_LOWER_SORT) == 0);  | 
523  |  | 
  | 
524  | 0  |   for (; dst < de && *nweights; (*nweights)--)  | 
525  | 0  |   { | 
526  | 0  |     int res;  | 
527  |  | #if OPTIMIZE_ASCII  | 
528  | 0  |     if (src >= se)  | 
529  | 0  |       break;  | 
530  | 0  |     if (src[0] <= 0x7F)  | 
531  | 0  |     { | 
532  | 0  |       wc= WEIGHT_MB1(*src++);  | 
533  | 0  |       PUT_WC_BE_HAVE_1BYTE(dst, de, wc);  | 
534  | 0  |       continue;  | 
535  | 0  |     }  | 
536  | 0  | #endif  | 
537  | 0  |     if ((res= MY_MB_WC(cs, &wc, src, se)) <= 0)  | 
538  | 0  |       break;  | 
539  | 0  |     src+= res;  | 
540  | 0  |     wc= MY_WC_WEIGHT(wc);  | 
541  | 0  |     PUT_WC_BE_HAVE_1BYTE(dst, de, wc);  | 
542  | 0  |   }  | 
543  | 0  |   return dst - dst0;  | 
544  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_filename Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb4_general1400_as_ci  | 
545  |  |  | 
546  |  |  | 
547  |  | static size_t  | 
548  |  | MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs,  | 
549  |  |                            uchar *dst, size_t dstlen, uint nweights,  | 
550  |  |                            const uchar *src, size_t srclen, uint flags)  | 
551  | 0  | { | 
552  | 0  |   uchar *dst0= dst;  | 
553  | 0  |   uchar *de= dst + dstlen;  | 
554  | 0  |   dst+= MY_FUNCTION_NAME(strnxfrm_internal)(cs, dst, de, &nweights,  | 
555  | 0  |                                             src, src + srclen);  | 
556  | 0  |   DBUG_ASSERT(dst <= de); /* Safety */  | 
557  |  | 
  | 
558  | 0  |   if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE))  | 
559  | 0  |     dst+= PAD_NWEIGHTS_UNICODE_BE(dst, de, nweights);  | 
560  |  | 
  | 
561  | 0  |   my_strxfrm_desc_and_reverse(dst0, dst, flags, 0);  | 
562  |  | 
  | 
563  | 0  |   if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de)  | 
564  | 0  |     dst+= PAD_UNICODE_BE(dst, de);  | 
565  | 0  |   return dst - dst0;  | 
566  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_ucs2_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_ucs2_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb3_general_mysql500_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb3_general1400_as_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_filename Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb4_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb4_general1400_as_ci  | 
567  |  |  | 
568  |  |  | 
569  |  | #ifdef DEFINE_STRNXFRM_UNICODE_NOPAD  | 
570  |  | static size_t  | 
571  |  | MY_FUNCTION_NAME(strnxfrm_nopad)(CHARSET_INFO *cs,  | 
572  |  |                                  uchar *dst, size_t dstlen,  | 
573  |  |                                  uint nweights,  | 
574  |  |                                  const uchar *src, size_t srclen, uint flags)  | 
575  | 0  | { | 
576  | 0  |   uchar *dst0= dst;  | 
577  | 0  |   uchar *de= dst + dstlen;  | 
578  | 0  |   dst+= MY_FUNCTION_NAME(strnxfrm_internal)(cs, dst, de, &nweights,  | 
579  | 0  |                                             src, src + srclen);  | 
580  | 0  |   DBUG_ASSERT(dst <= de); /* Safety */  | 
581  |  | 
  | 
582  | 0  |   if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE))  | 
583  | 0  |   { | 
584  | 0  |     size_t len= de - dst;  | 
585  | 0  |     set_if_smaller(len, nweights * 2);  | 
586  | 0  |     memset(dst, 0x00, len);  | 
587  | 0  |     dst+= len;  | 
588  | 0  |   }  | 
589  |  | 
  | 
590  | 0  |   my_strxfrm_desc_and_reverse(dst0, dst, flags, 0);  | 
591  |  | 
  | 
592  | 0  |   if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de)  | 
593  | 0  |   { | 
594  | 0  |     memset(dst, 0x00, de - dst);  | 
595  | 0  |     dst= de;  | 
596  | 0  |   }  | 
597  | 0  |   return dst - dst0;  | 
598  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_nopad_utf16_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_nopad_utf16le_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_nopad_utf32_general_ci Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_nopad_ucs2_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_nopad_utf8mb3_general_ci Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_nopad_utf8mb4_general_ci  | 
599  |  | #endif  | 
600  |  |  | 
601  |  | #endif /* DEFINE_STRNXFRM_UNICODE || DEFINE_STRNXFRM_UNICODE_NOPAD */  | 
602  |  |  | 
603  |  |  | 
604  |  |  | 
605  |  | #ifdef DEFINE_STRNXFRM_UNICODE_BIN2  | 
606  |  |  | 
607  |  | /*  | 
608  |  |   Store sorting weights using 2 bytes per character.  | 
609  |  |  | 
610  |  |   These functions are shared between  | 
611  |  |   - utf8mb3_general_ci, utf8mb3_bin, ucs2_general_ci, ucs2_bin  | 
612  |  |     which support BMP only (U+0000..U+FFFF).  | 
613  |  |   - utf8mb4_general_ci, utf16_general_ci, utf32_general_ci,  | 
614  |  |     which map all supplementary characters to weight 0xFFFD.  | 
615  |  | */  | 
616  |  |  | 
617  |  | #ifndef MY_MB_WC  | 
618  |  | #error MY_MB_WC must be defined for DEFINE_STRNXFRM_UNICODE_BIN2  | 
619  |  | #endif  | 
620  |  |  | 
621  |  | #ifndef OPTIMIZE_ASCII  | 
622  |  | #error OPTIMIZE_ASCII must be defined for DEFINE_STRNXFRM_UNICODE_BIN2  | 
623  |  | #endif  | 
624  |  |  | 
625  |  |  | 
626  |  | static size_t  | 
627  |  | MY_FUNCTION_NAME(strnxfrm_internal)(CHARSET_INFO *cs __attribute__((unused)),  | 
628  |  |                                     uchar *dst, uchar *de,  | 
629  |  |                                     uint *nweights,  | 
630  |  |                                     const uchar *src,  | 
631  |  |                                     const uchar *se)  | 
632  | 0  | { | 
633  | 0  |   my_wc_t UNINIT_VAR(wc);  | 
634  | 0  |   uchar *dst0= dst;  | 
635  |  | 
  | 
636  | 0  |   DBUG_ASSERT(src || !se);  | 
637  |  | 
  | 
638  | 0  |   for (; dst < de && *nweights; (*nweights)--)  | 
639  | 0  |   { | 
640  | 0  |     int res;  | 
641  |  | #if OPTIMIZE_ASCII  | 
642  | 0  |     if (src >= se)  | 
643  | 0  |       break;  | 
644  | 0  |     if (src[0] <= 0x7F)  | 
645  | 0  |     { | 
646  | 0  |       wc= *src++;  | 
647  | 0  |       PUT_WC_BE2_HAVE_1BYTE(dst, de, wc);  | 
648  | 0  |       continue;  | 
649  | 0  |     }  | 
650  | 0  | #endif  | 
651  | 0  |     if ((res= MY_MB_WC(cs, &wc, src, se)) <= 0)  | 
652  | 0  |       break;  | 
653  | 0  |     src+= res;  | 
654  | 0  |     if (wc > 0xFFFF)  | 
655  | 0  |       wc= MY_CS_REPLACEMENT_CHARACTER;  | 
656  | 0  |     PUT_WC_BE2_HAVE_1BYTE(dst, de, wc);  | 
657  | 0  |   }  | 
658  | 0  |   return dst - dst0;  | 
659  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_internal_ucs2_bin Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_internal_utf8mb3_bin  | 
660  |  |  | 
661  |  |  | 
662  |  | static size_t  | 
663  |  | MY_FUNCTION_NAME(strnxfrm)(CHARSET_INFO *cs,  | 
664  |  |                            uchar *dst, size_t dstlen, uint nweights,  | 
665  |  |                            const uchar *src, size_t srclen, uint flags)  | 
666  | 0  | { | 
667  | 0  |   uchar *dst0= dst;  | 
668  | 0  |   uchar *de= dst + dstlen;  | 
669  | 0  |   dst+= MY_FUNCTION_NAME(strnxfrm_internal)(cs, dst, de, &nweights,  | 
670  | 0  |                                             src, src + srclen);  | 
671  | 0  |   DBUG_ASSERT(dst <= de); /* Safety */  | 
672  |  | 
  | 
673  | 0  |   if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE))  | 
674  | 0  |     dst+= PAD_NWEIGHTS_UNICODE_BE(dst, de, nweights);  | 
675  |  | 
  | 
676  | 0  |   my_strxfrm_desc_and_reverse(dst0, dst, flags, 0);  | 
677  |  | 
  | 
678  | 0  |   if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de)  | 
679  | 0  |     dst+= PAD_UNICODE_BE(dst, de);  | 
680  | 0  |   return dst - dst0;  | 
681  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_ucs2_bin Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_utf8mb3_bin  | 
682  |  |  | 
683  |  |  | 
684  |  | static size_t  | 
685  |  | MY_FUNCTION_NAME(strnxfrm_nopad)(CHARSET_INFO *cs,  | 
686  |  |                                  uchar *dst, size_t dstlen, uint nweights,  | 
687  |  |                                  const uchar *src, size_t srclen, uint flags)  | 
688  | 0  | { | 
689  | 0  |   uchar *dst0= dst;  | 
690  | 0  |   uchar *de= dst + dstlen;  | 
691  | 0  |   dst+= MY_FUNCTION_NAME(strnxfrm_internal)(cs, dst, de, &nweights,  | 
692  | 0  |                                             src, src + srclen);  | 
693  | 0  |   DBUG_ASSERT(dst <= de); /* Safety */  | 
694  |  | 
  | 
695  | 0  |   if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE))  | 
696  | 0  |   { | 
697  | 0  |     size_t len= de - dst;  | 
698  | 0  |     set_if_smaller(len, nweights * 2);  | 
699  | 0  |     memset(dst, 0x00, len);  | 
700  | 0  |     dst+= len;  | 
701  | 0  |   }  | 
702  |  | 
  | 
703  | 0  |   my_strxfrm_desc_and_reverse(dst0, dst, flags, 0);  | 
704  |  | 
  | 
705  | 0  |   if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de)  | 
706  | 0  |   { | 
707  | 0  |     memset(dst, 0x00, de - dst);  | 
708  | 0  |     dst= de;  | 
709  | 0  |   }  | 
710  | 0  |   return dst - dst0;  | 
711  | 0  | } Unexecuted instantiation: ctype-ucs2.c:my_strnxfrm_nopad_ucs2_bin Unexecuted instantiation: ctype-utf8.c:my_strnxfrm_nopad_utf8mb3_bin  | 
712  |  |  | 
713  |  | #endif /* DEFINE_STRNXFRM_UNICODE_BIN2 */  | 
714  |  |  | 
715  |  |  | 
716  |  | /*  | 
717  |  |   We usually include this file at least two times from the same source file,  | 
718  |  |   for the _ci and the _bin collations. Prepare for the second inclusion.  | 
719  |  | */  | 
720  |  | #undef MY_FUNCTION_NAME  | 
721  |  | #undef MY_MB_WC  | 
722  |  | #undef OPTIMIZE_ASCII  | 
723  |  | #undef MY_WC_WEIGHT  | 
724  |  | #undef WEIGHT_ILSEQ  | 
725  |  | #undef WEIGHT_MB1  | 
726  |  | #undef WEIGHT_MB2  | 
727  |  | #undef WEIGHT_MB3  | 
728  |  | #undef WEIGHT_MB4  | 
729  |  | #undef WEIGHT_PAD_SPACE  | 
730  |  | #undef WEIGHT_MB2_FRM  | 
731  |  | #undef WEIGHT_SIZE  | 
732  |  | #undef DEFINE_STRNXFRM  | 
733  |  | #undef DEFINE_STRNXFRM_UNICODE  | 
734  |  | #undef DEFINE_STRNXFRM_UNICODE_NOPAD  | 
735  |  | #undef DEFINE_STRNXFRM_UNICODE_BIN2  | 
736  |  | #undef DEFINE_STRNNCOLL  | 
737  |  | #undef DEFINE_STRNNCOLLSP_NOPAD  | 
738  |  |  | 
739  |  | #undef STRCOLL_MB7_TOUPPER  | 
740  |  | #undef STRCOLL_MB7_BIN  | 
741  |  | #undef MY_STRCOLL_MB7_4BYTES  | 
742  |  | #undef MY_STRCOLL_MB7_8BYTES  | 
743  |  | #undef PUT_WC_BE_HAVE_1BYTE  | 
744  |  | #undef PAD_NWEIGHTS_UNICODE_BE  | 
745  |  | #undef PAD_UNICODE_BE  |