Move ini.pop_back() into ReadIniArgs
Both callers of ReadIniArgs need the string removed afterward. Prior to 8fb9a0f, only the parser for `-ini` needed the string removed. The caller for the automatic ini file ended and destroyed the container. As of 8fb9a0f, the container persists. Leaving the string in the container causes a bad error message if the command line is rejected. It is bad form to have ReadIniArgs pop, but the caller push. However, the two callers use different signatures for emplace_back(), so unifying the push would require calling a suboptimal emplace_back. Choose the lesser evil of unbalanced push/pop. Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/198>
This commit is contained in:
parent
660d18c312
commit
0bba26fde5
|
@ -186,6 +186,7 @@ static void ReadIniArgs(Inilist &ini)
|
||||||
Arglist Args;
|
Arglist Args;
|
||||||
AppendIniArgs(ini.back().filename().c_str(), Args);
|
AppendIniArgs(ini.back().filename().c_str(), Args);
|
||||||
ReadCmdArgs(ini, Args);
|
ReadCmdArgs(ini, Args);
|
||||||
|
ini.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ReadCmdArgs(Inilist &ini, Arglist &Args)
|
static void ReadCmdArgs(Inilist &ini, Arglist &Args)
|
||||||
|
@ -393,7 +394,6 @@ static void ReadCmdArgs(Inilist &ini, Arglist &Args)
|
||||||
if (ini.size() > 10)
|
if (ini.size() > 10)
|
||||||
throw nesting_depth_exceeded();
|
throw nesting_depth_exceeded();
|
||||||
ReadIniArgs(ini);
|
ReadIniArgs(ini);
|
||||||
ini.pop_back();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw unhandled_argument(std::move(*pp));
|
throw unhandled_argument(std::move(*pp));
|
||||||
|
|
Loading…
Reference in a new issue