Skip to content
Snippets Groups Projects
Commit d6cb18ab authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Do not initialize subfields of options_ as empty structs if they are already...

Do not initialize subfields of options_ as empty structs if they are already defined (in global_initialization).
parent 9586f1e5
Branches
Tags
No related merge requests found
...@@ -135,7 +135,11 @@ OptionsList::writeOutput(ostream &output) const ...@@ -135,7 +135,11 @@ OptionsList::writeOutput(ostream &output) const
void void
OptionsList::writeOutput(ostream &output, const string &option_group) const OptionsList::writeOutput(ostream &output, const string &option_group) const
{ {
output << option_group << " = struct();" << endl; // Initialize option_group as an empty struct iff the field does not exist!
unsigned idx = option_group.find_last_of(".");
output << "if ~isfield(" << option_group.substr(0,idx) << ",'" << option_group.substr(idx+1) << "')" << endl;
output << " " << option_group << " = struct();" << endl;
output << "end" << endl;
for (num_options_t::const_iterator it = num_options.begin(); for (num_options_t::const_iterator it = num_options.begin();
it != num_options.end(); it++) it != num_options.end(); it++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment