C++11/14 code cleanup: NULL to nullptr for default_value options.

This commit is contained in:
Joseph Lenox 2018-07-04 13:44:51 -05:00 committed by Joseph Lenox
parent a16bb63821
commit d612bf02a4
2 changed files with 6 additions and 6 deletions

View File

@ -189,7 +189,7 @@ operator!= (const ConfigOption &a, const ConfigOption &b)
} }
ConfigOptionDef::ConfigOptionDef(const ConfigOptionDef &other) ConfigOptionDef::ConfigOptionDef(const ConfigOptionDef &other)
: type(other.type), default_value(NULL), : type(other.type), default_value(nullptr),
gui_type(other.gui_type), gui_flags(other.gui_flags), label(other.label), gui_type(other.gui_type), gui_flags(other.gui_flags), label(other.label),
full_label(other.full_label), category(other.category), tooltip(other.tooltip), full_label(other.full_label), category(other.category), tooltip(other.tooltip),
sidetext(other.sidetext), cli(other.cli), ratio_over(other.ratio_over), sidetext(other.sidetext), cli(other.cli), ratio_over(other.ratio_over),
@ -198,13 +198,13 @@ ConfigOptionDef::ConfigOptionDef(const ConfigOptionDef &other)
aliases(other.aliases), shortcut(other.shortcut), enum_values(other.enum_values), aliases(other.aliases), shortcut(other.shortcut), enum_values(other.enum_values),
enum_labels(other.enum_labels), enum_keys_map(other.enum_keys_map) enum_labels(other.enum_labels), enum_keys_map(other.enum_keys_map)
{ {
if (other.default_value != NULL) if (other.default_value != nullptr)
this->default_value = other.default_value->clone(); this->default_value = other.default_value->clone();
} }
ConfigOptionDef::~ConfigOptionDef() ConfigOptionDef::~ConfigOptionDef()
{ {
if (this->default_value != NULL) if (this->default_value != nullptr)
delete this->default_value; delete this->default_value;
} }
@ -457,7 +457,7 @@ DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) {
const ConfigOptionDef* optdef = this->def->get(opt_key); const ConfigOptionDef* optdef = this->def->get(opt_key);
if (optdef == NULL) return NULL; if (optdef == NULL) return NULL;
ConfigOption* opt; ConfigOption* opt;
if (optdef->default_value != NULL) { if (optdef->default_value != nullptr) {
opt = optdef->default_value->clone(); opt = optdef->default_value->clone();
} else if (optdef->type == coFloat) { } else if (optdef->type == coFloat) {
opt = new ConfigOptionFloat (); opt = new ConfigOptionFloat ();
@ -639,7 +639,7 @@ StaticConfig::set_defaults()
t_config_option_keys keys = this->keys(); t_config_option_keys keys = this->keys();
for (t_config_option_keys::const_iterator it = keys.begin(); it != keys.end(); ++it) { for (t_config_option_keys::const_iterator it = keys.begin(); it != keys.end(); ++it) {
const ConfigOptionDef* def = this->def->get(*it); const ConfigOptionDef* def = this->def->get(*it);
if (def->default_value != NULL) if (def->default_value != nullptr)
this->option(*it)->set(*def->default_value); this->option(*it)->set(*def->default_value);
} }
} }

View File

@ -640,7 +640,7 @@ class ConfigOptionDef
/// Initialized by ConfigOptionEnum<xxx>::get_enum_values() /// Initialized by ConfigOptionEnum<xxx>::get_enum_values()
t_config_enum_values enum_keys_map; t_config_enum_values enum_keys_map;
ConfigOptionDef() : type(coNone), default_value(NULL), ConfigOptionDef() : type(coNone), default_value(nullptr),
multiline(false), full_width(false), readonly(false), multiline(false), full_width(false), readonly(false),
height(-1), width(-1), min(INT_MIN), max(INT_MAX) {}; height(-1), width(-1), min(INT_MIN), max(INT_MAX) {};
ConfigOptionDef(const ConfigOptionDef &other); ConfigOptionDef(const ConfigOptionDef &other);