1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

change lex_string_eq to return what it says

the function xxx_eq(a,b) returns true if two elements
are equal and false if they are not.
This commit is contained in:
Sergei Golubchik
2018-03-30 15:42:38 +02:00
parent 479bd5a6fe
commit 0dcb47cae9
3 changed files with 18 additions and 21 deletions

View File

@ -21,9 +21,8 @@
typedef struct st_mysql_const_lex_string LEX_CSTRING;
/* 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)
static inline bool lex_string_cmp(CHARSET_INFO *charset, const LEX_CSTRING *a,
const LEX_CSTRING *b)
{
return my_strcasecmp(charset, a->str, b->str);
}
@ -31,7 +30,7 @@ inline bool lex_string_cmp(CHARSET_INFO *charset,
/*
Compare to LEX_CSTRING's and return 0 if equal
*/
inline bool cmp(const LEX_CSTRING *a, const LEX_CSTRING *b)
static inline bool cmp(const LEX_CSTRING *a, const LEX_CSTRING *b)
{
return (a->length != b->length ||
memcmp(a->str, b->str, a->length));
@ -41,12 +40,11 @@ inline bool cmp(const LEX_CSTRING *a, const LEX_CSTRING *b)
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)
static 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;
return 0; /* Different */
return strcasecmp(a->str, b->str) == 0;
}
#endif /* LEX_STRING_INCLUDED */