Skip to content

Commit

Permalink
Merge pull request mogutt#9 from ayrb13/master
Browse files Browse the repository at this point in the history
优化CConfigFileReader::GetConfigName方法
  • Loading branch information
bluefoxah committed Nov 3, 2014
2 parents ca3a9ab + fb737fa commit 5358b0a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions cpp/src/base/ConfigFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ char* CConfigFileReader::GetConfigName(const char* name)
return NULL;

char* value = NULL;
map<string, string>::iterator it = m_config_map->begin();
for ( ; it != m_config_map->end(); it++)
map<string, string>::iterator it = m_config_map->find(name);

if(it != m_config_map->end())
{
const char* key = it->first.c_str();
if (strcmp(key, name) == 0)
{
value = (char*)it->second.c_str();
break;
}
value = (char*)it->second.c_str();
}

return value;
Expand Down

0 comments on commit 5358b0a

Please sign in to comment.