1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

post-review fixes

This commit is contained in:
petr@mysql.com
2004-11-02 10:11:03 +03:00
parent e415866cfe
commit d3dc041dd1
13 changed files with 142 additions and 115 deletions

View File

@ -93,13 +93,16 @@ static void delete_user(void *u)
C_MODE_END
User_map::User_map()
int User_map::init()
{
enum { START_HASH_SIZE = 16 };
hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
get_user_key, delete_user, 0);
if (hash_init(&hash, default_charset_info, START_HASH_SIZE, 0, 0,
get_user_key, delete_user, 0))
return 1;
return 0;
}
User_map::~User_map()
{
hash_free(&hash);
@ -134,7 +137,8 @@ int User_map::load(const char *password_file_name)
while (fgets(line, sizeof(line), file))
{
/* skip comments and empty lines */
if (line[0] == '#' || line[0] == '\n' && line[1] == '\0')
if (line[0] == '#' || line[0] == '\n' &&
(line[1] == '\0' || line[1] == '\r'))
continue;
if ((user= new User) == 0)
goto done;