chore: use nullptr where possible in place of NULL

This commit is contained in:
sithlord48
2025-04-27 15:39:23 -04:00
committed by Nick Bolton
parent 60dc4c0cd8
commit 63d65bb47b
140 changed files with 1116 additions and 1101 deletions

View File

@ -258,7 +258,7 @@ void Config::setDeskflowAddress(const NetworkAddress &addr)
bool Config::addOption(const std::string &name, OptionID option, OptionValue value)
{
// find options
ScreenOptions *options = NULL;
ScreenOptions *options = nullptr;
if (name.empty()) {
options = &m_globalOptions;
} else {
@ -267,7 +267,7 @@ bool Config::addOption(const std::string &name, OptionID option, OptionValue val
options = &index->second.m_options;
}
}
if (options == NULL) {
if (options == nullptr) {
return false;
}
@ -279,7 +279,7 @@ bool Config::addOption(const std::string &name, OptionID option, OptionValue val
bool Config::removeOption(const std::string &name, OptionID option)
{
// find options
ScreenOptions *options = NULL;
ScreenOptions *options = nullptr;
if (name.empty()) {
options = &m_globalOptions;
} else {
@ -288,7 +288,7 @@ bool Config::removeOption(const std::string &name, OptionID option)
options = &index->second.m_options;
}
}
if (options == NULL) {
if (options == nullptr) {
return false;
}
@ -300,7 +300,7 @@ bool Config::removeOption(const std::string &name, OptionID option)
bool Config::removeOptions(const std::string &name)
{
// find options
ScreenOptions *options = NULL;
ScreenOptions *options = nullptr;
if (name.empty()) {
options = &m_globalOptions;
} else {
@ -309,7 +309,7 @@ bool Config::removeOptions(const std::string &name)
options = &index->second.m_options;
}
}
if (options == NULL) {
if (options == nullptr) {
return false;
}
@ -432,7 +432,7 @@ Config::getNeighbor(const std::string &srcName, EDirection srcSide, float positi
return "";
} else {
// compute position on neighbor
if (positionOut != NULL) {
if (positionOut != nullptr) {
*positionOut = dstEdge->inverseTransform(srcEdge->transform(position));
}
@ -481,7 +481,7 @@ const NetworkAddress &Config::getDeskflowAddress() const
const Config::ScreenOptions *Config::getOptions(const std::string &name) const
{
// find options
const ScreenOptions *options = NULL;
const ScreenOptions *options = nullptr;
if (name.empty()) {
options = &m_globalOptions;
} else {
@ -1254,7 +1254,7 @@ const char *Config::getOptionName(OptionID id)
if (id == kOptionClipboardSharingSize) {
return "clipboardSharingSize";
}
return NULL;
return nullptr;
}
std::string Config::getOptionValue(OptionID id, OptionValue value)
@ -1605,11 +1605,11 @@ std::ostream &operator<<(std::ostream &s, const Config &config)
for (Config::const_iterator screen = config.begin(); screen != config.end(); ++screen) {
s << "\t" << screen->c_str() << ":" << std::endl;
const Config::ScreenOptions *options = config.getOptions(*screen);
if (options != NULL && options->size() > 0) {
if (options != nullptr && options->size() > 0) {
for (Config::ScreenOptions::const_iterator option = options->begin(); option != options->end(); ++option) {
const char *name = Config::getOptionName(option->first);
std::string value = Config::getOptionValue(option->first, option->second);
if (name != NULL && !value.empty()) {
if (name != nullptr && !value.empty()) {
s << "\t\t" << name << " = " << value << std::endl;
}
}
@ -1659,11 +1659,11 @@ std::ostream &operator<<(std::ostream &s, const Config &config)
// options section
s << "section: options" << std::endl;
const Config::ScreenOptions *options = config.getOptions("");
if (options != NULL && options->size() > 0) {
if (options != nullptr && options->size() > 0) {
for (Config::ScreenOptions::const_iterator option = options->begin(); option != options->end(); ++option) {
const char *name = Config::getOptionName(option->first);
std::string value = Config::getOptionValue(option->first, option->second);
if (name != NULL && !value.empty()) {
if (name != nullptr && !value.empty()) {
s << "\t" << name << " = " << value << std::endl;
}
}