154
154
} /* find_type */
158
Un-hex all elements in a typelib
162
interval TYPELIB (struct of pointer to values + lengths + count)
170
void unhex_type2(TYPELIB *interval)
172
for (uint32_t pos= 0; pos < interval->count; pos++)
175
for (from= to= (char*) interval->type_names[pos]; *from; )
178
Note, hexchar_to_int(*from++) doesn't work
179
one some compilers, e.g. IRIX. Looks like a compiler
180
bug in inline functions in combination with arguments
181
that have a side effect. So, let's use from[0] and from[1]
182
and increment 'from' by two later.
185
*to++= (char) (hexchar_to_int(from[0]) << 4) +
186
hexchar_to_int(from[1]);
189
interval->type_lengths[pos] /= 2;
195
Check if the first word in a string is one of the ones in TYPELIB
202
end_of_word Store value of last used byte here if we found word
206
> 1 lib->type_names[#-1] matched
207
end_of_word will point to separator character/end in 'val'
210
uint32_t check_word(TYPELIB *lib, const char *val, const char *end,
211
const char **end_of_word)
216
/* Fiend end of word */
217
for (ptr= val ; ptr < end && my_isalpha(&my_charset_utf8_general_ci, *ptr) ; ptr++)
219
if ((res=find_type(lib, val, (uint32_t) (ptr - val), 1)) > 0)
226
Searches for a LEX_STRING in an LEX_STRING array.
229
find_string_in_array()
231
needle The string to search for
234
The last LEX_STRING in the array should have str member set to NULL
241
int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
242
const CHARSET_INFO * const cs)
244
const LEX_STRING *pos;
245
for (pos= haystack; pos->str; pos++)
246
if (!cs->coll->strnncollsp(cs, (unsigned char *) pos->str, pos->length,
247
(unsigned char *) needle->str, needle->length, 0))
249
return (pos - haystack);