Core: optimize string splitting
- Mainly affects item loading performance - Reduces guild loading time a lot --HG-- branch : trunk
This commit is contained in:
1 parent
f275f8b4b5
commit
d9d1ec3670
9 files changed
+64
-55
No files matched your search
@@ -32,19 +32,18 @@ struct MySQLConnectionInfo
|
||||
MySQLConnectionInfo() {}
|
||||
MySQLConnectionInfo(const std::string& infoString)
|
||||
{
|
||||
Tokens tokens = StrSplit(infoString, ";");
|
||||
Tokens::iterator iter = tokens.begin();
|
||||
Tokens tokens(infoString, ';');
|
||||
|
||||
if (iter != tokens.end())
|
||||
host = *iter++;
|
||||
if (iter != tokens.end())
|
||||
port_or_socket = *iter++;
|
||||
if (iter != tokens.end())
|
||||
user = *iter++;
|
||||
if (iter != tokens.end())
|
||||
password = *iter++;
|
||||
if (iter != tokens.end())
|
||||
database = *iter++;
|
||||
if (tokens.size() != 5)
|
||||
return;
|
||||
|
||||
uint8 i = 0;
|
||||
|
||||
host.assign(tokens[i++]);
|
||||
port_or_socket.assign(tokens[i++]);
|
||||
user.assign(tokens[i++]);
|
||||
password.assign(tokens[i++]);
|
||||
database.assign(tokens[i++]);
|
||||
}
|
||||
|
||||
std::string user;
|
||||
|
||||
Reference in new issue
Block a user