diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2014-05-29 14:53:16 -0700 |
|---|---|---|
| committer | shuffle2 <godisgovernment@gmail.com> | 2014-05-29 14:53:16 -0700 |
| commit | fd6fd8fcf13ee6bdb6eab8eded0824521527adc3 (patch) | |
| tree | 53345ec49f9b0a4f6a2cdf21159159391ac8be87 /Source/Core/Common/IniFile.cpp | |
| parent | 3b23f4bbd61ab4ad2b92fd451a65e0839dc49ebc (diff) | |
| parent | eca70d1562c7acbe9a48944817c9fca34d93b8b5 (diff) | |
Merge pull request #433 from lioncash/ini
Get rid of the temporary buffer in IniFile's Load function.
Diffstat (limited to 'Source/Core/Common/IniFile.cpp')
| -rw-r--r-- | Source/Core/Common/IniFile.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 0424e20014..642835ac90 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -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 @@ -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; |
