1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Optimize LEX_STRING comparisons

- Added inline lex_string_cmp() to replace my_strcase_cmp().
- Added inline lex_string_eq to first compares lengths before comparing strings
This commit is contained in:
Michael Widenius
2017-06-18 14:00:28 +03:00
committed by Sergei Golubchik
parent cc77f9882d
commit 25c06f5282
14 changed files with 137 additions and 137 deletions

View File

@ -6118,6 +6118,25 @@ public:
}
};
/* Functions to compare if two lex strings are equal */
inline bool lex_string_cmp(CHARSET_INFO *charset,
const LEX_CSTRING *a,
const LEX_CSTRING *b)
{
return my_strcasecmp(charset, a->str, b->str);
}
/*
Compare if two LEX_CSTRING are equal. Assumption is that
character set is ASCII (like for plugin names)
*/
inline bool lex_string_eq(const LEX_CSTRING *a,
const LEX_CSTRING *b)
{
if (a->length != b->length)
return 1; /* Different */
return strcasecmp(a->str, b->str) != 0;
}
#endif /* MYSQL_SERVER */