Skip to content

Commit

Permalink
Merge pull request #433 from lioncash/ini
Browse files Browse the repository at this point in the history
Get rid of the temporary buffer in IniFile's Load function.
  • Loading branch information
shuffle2 committed May 29, 2014
2 parents 3b23f4b + eca70d1 commit fd6fd8f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Source/Core/Common/IniFile.cpp
Expand Up @@ -328,9 +328,6 @@ void IniFile::SortSections()

bool IniFile::Load(const std::string& filename, bool keep_current_data)
{
// Maximum number of letters in a line
static const int MAX_BYTES = 1024*32;

if (!keep_current_data)
sections.clear();
// first section consists of the comments before the first real section
Expand All @@ -339,18 +336,15 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data)
std::ifstream in;
OpenFStream(in, filename, std::ios::in);

if (in.fail()) return false;
if (in.fail())
return false;

Section* current_section = nullptr;
while (!in.eof())
{
char templine[MAX_BYTES];
std::string line;
if (in.getline(templine, MAX_BYTES))
{
line = templine;
}
else

if (!std::getline(in, line))
{
if (in.eof())
return true;
Expand Down

0 comments on commit fd6fd8f

Please sign in to comment.