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:
@ -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 */
|
||||
|
@ -1482,10 +1482,10 @@ static const char *fix_plugin_ptr(const char *name)
|
||||
*/
|
||||
static bool fix_user_plugin_ptr(ACL_USER *user)
|
||||
{
|
||||
if (lex_string_eq(&user->plugin, &native_password_plugin_name) == 0)
|
||||
if (lex_string_eq(&user->plugin, &native_password_plugin_name))
|
||||
user->plugin= native_password_plugin_name;
|
||||
else
|
||||
if (lex_string_eq(&user->plugin, &old_password_plugin_name) == 0)
|
||||
if (lex_string_eq(&user->plugin, &old_password_plugin_name))
|
||||
user->plugin= old_password_plugin_name;
|
||||
else
|
||||
return true;
|
||||
@ -1525,10 +1525,10 @@ static bool fix_lex_user(THD *thd, LEX_USER *user)
|
||||
DBUG_ASSERT(user->plugin.length || !user->auth.length);
|
||||
DBUG_ASSERT(!(user->plugin.length && (user->pwtext.length || user->pwhash.length)));
|
||||
|
||||
if (lex_string_eq(&user->plugin, &native_password_plugin_name) == 0)
|
||||
if (lex_string_eq(&user->plugin, &native_password_plugin_name))
|
||||
check_length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
|
||||
else
|
||||
if (lex_string_eq(&user->plugin, &old_password_plugin_name) == 0)
|
||||
if (lex_string_eq(&user->plugin, &old_password_plugin_name))
|
||||
check_length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
|
||||
else
|
||||
if (user->plugin.length)
|
||||
@ -11213,7 +11213,7 @@ applicable_roles_insert(ACL_USER_BASE *grantee, ACL_ROLE *role, void *ptr)
|
||||
if (!is_role)
|
||||
{
|
||||
if (data->user->default_rolename.length &&
|
||||
!lex_string_eq(&data->user->default_rolename, &role->user))
|
||||
lex_string_eq(&data->user->default_rolename, &role->user))
|
||||
table->field[3]->store(STRING_WITH_LEN("YES"), cs);
|
||||
else
|
||||
table->field[3]->store(STRING_WITH_LEN("NO"), cs);
|
||||
@ -12825,8 +12825,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
|
||||
restarted and a server auth plugin will read the data that the client
|
||||
has just send. Cache them to return in the next server_mpvio_read_packet().
|
||||
*/
|
||||
if (lex_string_eq(&mpvio->acl_user->plugin,
|
||||
plugin_name(mpvio->plugin)) != 0)
|
||||
if (!lex_string_eq(&mpvio->acl_user->plugin, plugin_name(mpvio->plugin)))
|
||||
{
|
||||
mpvio->cached_client_reply.pkt= passwd;
|
||||
mpvio->cached_client_reply.pkt_len= (uint)passwd_len;
|
||||
@ -13256,7 +13255,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
|
||||
{
|
||||
DBUG_ASSERT(mpvio.acl_user);
|
||||
DBUG_ASSERT(command == COM_CHANGE_USER ||
|
||||
lex_string_eq(auth_plugin_name, &mpvio.acl_user->plugin));
|
||||
!lex_string_eq(auth_plugin_name, &mpvio.acl_user->plugin));
|
||||
auth_plugin_name= &mpvio.acl_user->plugin;
|
||||
res= do_auth_once(thd, auth_plugin_name, &mpvio);
|
||||
}
|
||||
|
10
sql/table.cc
10
sql/table.cc
@ -252,21 +252,21 @@ TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
|
||||
if (is_infoschema_db(db))
|
||||
return TABLE_CATEGORY_INFORMATION;
|
||||
|
||||
if (lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, db) == 0)
|
||||
if (lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, db))
|
||||
return TABLE_CATEGORY_PERFORMANCE;
|
||||
|
||||
if (lex_string_eq(&MYSQL_SCHEMA_NAME, db) == 0)
|
||||
if (lex_string_eq(&MYSQL_SCHEMA_NAME, db))
|
||||
{
|
||||
if (is_system_table_name(name->str, name->length))
|
||||
return TABLE_CATEGORY_SYSTEM;
|
||||
|
||||
if (lex_string_eq(&GENERAL_LOG_NAME, name) == 0)
|
||||
if (lex_string_eq(&GENERAL_LOG_NAME, name))
|
||||
return TABLE_CATEGORY_LOG;
|
||||
|
||||
if (lex_string_eq(&SLOW_LOG_NAME, name) == 0)
|
||||
if (lex_string_eq(&SLOW_LOG_NAME, name))
|
||||
return TABLE_CATEGORY_LOG;
|
||||
|
||||
if (lex_string_eq(&TRANSACTION_REG_NAME, name) == 0)
|
||||
if (lex_string_eq(&TRANSACTION_REG_NAME, name))
|
||||
return TABLE_CATEGORY_LOG;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user