aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-08-04 22:04:15 -0700
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-08-04 22:11:01 -0700
commitd81457e4208ba6ed94b86e430c567e4c0e1f7046 (patch)
tree971aa44d14aa446e6f7641d4bf4c1279de0f0b54
parentf3cd2455110fad09158275287cbdaa67cc3e15c3 (diff)
downloadpaludis-d81457e4208ba6ed94b86e430c567e4c0e1f7046.tar.gz
paludis-d81457e4208ba6ed94b86e430c567e4c0e1f7046.tar.xz
modernize: use nullptr rather than 0 or NULL
Automated conversion to nullptr. NFC.
-rw-r--r--paludis/broken_linkage_finder.cc2
-rw-r--r--paludis/hooker.cc12
-rw-r--r--paludis/match_package.cc2
-rw-r--r--paludis/partially_made_package_dep_spec.cc4
-rw-r--r--paludis/repositories/e/do_info_action.cc2
-rw-r--r--paludis/repositories/e/e_repository.cc8
-rw-r--r--paludis/repositories/e/vdb_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc4
-rw-r--r--paludis/resolver/get_use_existing_nothing_helper.cc2
-rw-r--r--paludis/resolver/sanitised_dependencies.cc8
-rw-r--r--paludis/selinux/security_context.cc36
-rw-r--r--paludis/util/buffer_output_stream.cc2
-rw-r--r--paludis/util/config_file_TEST.cc4
-rw-r--r--paludis/util/cookie.cc2
-rw-r--r--paludis/util/exception.cc2
-rw-r--r--paludis/util/fs_iterator.cc4
-rw-r--r--paludis/util/log.cc2
-rw-r--r--paludis/util/pty.cc2
-rw-r--r--src/clients/cave/cmd_display_resolution.cc2
19 files changed, 51 insertions, 51 deletions
diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc
index 0ad1d3d..169c97a 100644
--- a/paludis/broken_linkage_finder.cc
+++ b/paludis/broken_linkage_finder.cc
@@ -339,7 +339,7 @@ Imp<BrokenLinkageFinder>::gather_package(const std::shared_ptr<const PackageID>
it_end(contents->end()); it_end != it; ++it)
{
const ContentsFileEntry * file(visitor_cast<const ContentsFileEntry>(**it));
- if (0 != file)
+ if (nullptr != file)
{
std::unique_lock<std::mutex> l(mutex);
files.insert(std::make_pair(file->location_key()->parse_value(), pkg));
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 1c339bf..d4a2be8 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -396,9 +396,9 @@ FancyHookFile::_add_dependency_class(const Hook & hook, DirectedGraph<std::strin
SoHookFile::SoHookFile(const FSPath & f, const bool, const Environment * const e) :
_file_name(f),
_env(e),
- _dl(0),
- _run(0),
- _add_dependencies(0)
+ _dl(nullptr),
+ _run(nullptr),
+ _add_dependencies(nullptr)
{
/* don't use RTLD_LOCAL, g++ is over happy about template instantiations, and it
* can lead to multiple singleton instances. */
@@ -559,14 +559,14 @@ namespace
PyHookFileHandle() :
- handle(0),
- create_py_hook_file_handle(0)
+ handle(nullptr),
+ create_py_hook_file_handle(nullptr)
{
}
~PyHookFileHandle()
{
- if (0 != handle)
+ if (nullptr != handle)
dlclose(handle);
}
};
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index e7ecbb4..36c25ce 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -242,7 +242,7 @@ paludis::match_package(
const std::shared_ptr<const PackageID> & from_id,
const MatchPackageOptions & options)
{
- return match_package_with_maybe_changes(env, spec, 0, id, from_id, 0, options);
+ return match_package_with_maybe_changes(env, spec, nullptr, id, from_id, nullptr, options);
}
bool
diff --git a/paludis/partially_made_package_dep_spec.cc b/paludis/partially_made_package_dep_spec.cc
index e3fca24..4ffd0df 100644
--- a/paludis/partially_made_package_dep_spec.cc
+++ b/paludis/partially_made_package_dep_spec.cc
@@ -73,7 +73,7 @@ namespace
package(other.package_ptr()),
package_name_part(other.package_name_part_ptr()),
category_name_part(other.category_name_part_ptr()),
- version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
+ version_requirements(other.version_requirements_ptr() ? new VersionRequirements : nullptr),
version_requirements_mode_v(other.version_requirements_mode()),
slot(other.slot_requirement_ptr()),
in_repository(other.in_repository_ptr()),
@@ -81,7 +81,7 @@ namespace
installable_to_repository(other.installable_to_repository_ptr()),
installed_at_path(other.installed_at_path_ptr()),
installable_to_path(other.installable_to_path_ptr()),
- additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0),
+ additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : nullptr),
options_for_partially_made_package_dep_spec_v(other.options_for_partially_made_package_dep_spec())
{
if (version_requirements)
diff --git a/paludis/repositories/e/do_info_action.cc b/paludis/repositories/e/do_info_action.cc
index 85944b5..bedb2d3 100644
--- a/paludis/repositories/e/do_info_action.cc
+++ b/paludis/repositories/e/do_info_action.cc
@@ -121,7 +121,7 @@ paludis::erepository::do_info_action(
n::expand_vars() = expand_vars,
n::info_vars() = repo->info_vars_key() ?
repo->info_vars_key()->parse_value() : std::make_shared<const Set<std::string>>(),
- n::load_environment() = static_cast<const FSPath *>(0),
+ n::load_environment() = static_cast<const FSPath *>(nullptr),
n::profiles() = params.profiles(),
n::profiles_with_parents() = profile->profiles_with_parents(),
n::use() = use,
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 6264d4b..b491af3 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -534,7 +534,7 @@ ERepository::ERepository(const ERepositoryParams & p) :
p.environment(),
fetch_repo_name(p.location()),
make_named_values<RepositoryCapabilities>(
- n::destination_interface() = p.binary_destination() ? this : 0,
+ n::destination_interface() = p.binary_destination() ? this : nullptr,
n::environment_variable_interface() = this,
n::manifest_interface() = this
)),
@@ -695,7 +695,7 @@ ERepository::need_mirrors() const
if (! ee.empty())
{
/* pick up to five random mirrors only */
- std::mt19937 random(std::time(0));
+ std::mt19937 random(std::time(nullptr));
Randomator randomator{random};
std::random_shuffle(next(ee.begin()), ee.end(), randomator);
if (ee.size() > 6)
@@ -1142,7 +1142,7 @@ ERepository::repository_factory_create(
std::shared_ptr<KeyValueConfigFile> layout_conf((FSPath(location) / "metadata/layout.conf").stat().exists() ?
new KeyValueConfigFile(FSPath(location) / "metadata/layout.conf", { },
&KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)
- : 0);
+ : nullptr);
std::shared_ptr<ERepositorySequence> master_repositories;
std::string master_repository_str(f("master_repository"));
@@ -1533,7 +1533,7 @@ ERepository::repository_factory_dependencies(
std::shared_ptr<KeyValueConfigFile> layout_conf((FSPath(location) / "metadata/layout.conf").stat().exists() ?
new KeyValueConfigFile(FSPath(location) / "metadata/layout.conf", { },
&KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)
- : 0);
+ : nullptr);
if (layout_conf)
{
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 7aab15e..5f59a4f 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -164,7 +164,7 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
make_named_values<RepositoryCapabilities>(
n::destination_interface() = this,
n::environment_variable_interface() = this,
- n::manifest_interface() = static_cast<RepositoryManifestInterface *>(0)
+ n::manifest_interface() = static_cast<RepositoryManifestInterface *>(nullptr)
)),
_imp(this, p)
{
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index a4922ac..2982dfc 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -59,8 +59,8 @@ namespace paludis
FakeInstalledRepository::FakeInstalledRepository(const FakeInstalledRepositoryParams & p) :
FakeRepositoryBase(p.environment(), p.name(), make_named_values<RepositoryCapabilities>(
n::destination_interface() = this,
- n::environment_variable_interface() = static_cast<RepositoryEnvironmentVariableInterface *>(0),
- n::manifest_interface() = static_cast<RepositoryManifestInterface *>(0)
+ n::environment_variable_interface() = static_cast<RepositoryEnvironmentVariableInterface *>(nullptr),
+ n::manifest_interface() = static_cast<RepositoryManifestInterface *>(nullptr)
)),
_imp(p.supports_uninstall(), p.suitable_destination())
{
diff --git a/paludis/resolver/get_use_existing_nothing_helper.cc b/paludis/resolver/get_use_existing_nothing_helper.cc
index f141625..1f86e4d 100644
--- a/paludis/resolver/get_use_existing_nothing_helper.cc
+++ b/paludis/resolver/get_use_existing_nothing_helper.cc
@@ -122,7 +122,7 @@ namespace
bool creating_and_no_appropriate_ids() const
{
- bool (* can)(const std::shared_ptr<const PackageID> &)(0);
+ bool (* can)(const std::shared_ptr<const PackageID> &)(nullptr);
switch (resolvent.destination_type())
{
case dt_install_to_slash:
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 0ac5969..deb3b53 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -139,7 +139,7 @@ namespace
parent_make_sanitised(f),
super_complicated(false),
nested(false),
- active_sublist(0),
+ active_sublist(nullptr),
seen_any(false)
{
}
@@ -194,7 +194,7 @@ namespace
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
else
{
- Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, 0);
+ Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, nullptr);
active_sublist = &*child_groups.insert(child_groups.end(), std::list<PackageOrBlockDepSpec>());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
@@ -209,7 +209,7 @@ namespace
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
else
{
- Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, 0);
+ Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, nullptr);
active_sublist = &*child_groups.insert(child_groups.end(), std::list<PackageOrBlockDepSpec>());
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
@@ -233,7 +233,7 @@ namespace
}
else
{
- Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, 0);
+ Save<std::list<PackageOrBlockDepSpec> *> save_active_sublist(&active_sublist, nullptr);
active_sublist = &*child_groups.insert(child_groups.end(), std::list<PackageOrBlockDepSpec>());
for (std::list<SanitisedDependency>::const_iterator i(l.begin()), i_end(l.end()) ;
i != i_end ; ++i)
diff --git a/paludis/selinux/security_context.cc b/paludis/selinux/security_context.cc
index 1ffd19d..480141a 100644
--- a/paludis/selinux/security_context.cc
+++ b/paludis/selinux/security_context.cc
@@ -53,13 +53,13 @@ namespace
public:
LibSELinux() :
- _handle(0), _freecon(0), _getcon(0),
- _getfscreatecon(0), _setfscreatecon(0),
- _matchpathcon(0), _matchpathcon_init(0),
- _is_selinux_enabled(0)
+ _handle(nullptr), _freecon(nullptr), _getcon(nullptr),
+ _getfscreatecon(nullptr), _setfscreatecon(nullptr),
+ _matchpathcon(nullptr), _matchpathcon_init(nullptr),
+ _is_selinux_enabled(nullptr)
{
_handle = dlopen("libselinux.so", RTLD_LAZY | RTLD_LOCAL);
- if (0 != _handle)
+ if (nullptr != _handle)
{
_freecon = STUPID_CAST(void (*)(security_context_t), dlsym(_handle, "freecon"));
_getcon = STUPID_CAST(int (*)(security_context_t*), dlsym(_handle, "getcon"));
@@ -80,54 +80,54 @@ namespace
~LibSELinux()
{
- if (0 != _handle)
+ if (nullptr != _handle)
dlclose(_handle);
}
void freecon(security_context_t c)
{
- if (0 != _freecon && is_selinux_enabled())
+ if (nullptr != _freecon && is_selinux_enabled())
_freecon(c);
}
int getcon(security_context_t *c)
{
- if (0 != _getcon && is_selinux_enabled())
+ if (nullptr != _getcon && is_selinux_enabled())
return _getcon(c);
return 0;
}
int getfscreatecon(security_context_t *c)
{
- if (0 != _getfscreatecon && is_selinux_enabled())
+ if (nullptr != _getfscreatecon && is_selinux_enabled())
return _getfscreatecon(c);
return 0;
}
int setfscreatecon(security_context_t c)
{
- if (0 != _setfscreatecon && is_selinux_enabled())
+ if (nullptr != _setfscreatecon && is_selinux_enabled())
return _setfscreatecon(c);
return 0;
}
int matchpathcon(const char *path, mode_t mode, security_context_t *con)
{
- if (0 != _matchpathcon && is_selinux_enabled())
+ if (nullptr != _matchpathcon && is_selinux_enabled())
return _matchpathcon(path, mode, con);
return 0;
}
int setfilecon(const char *path, security_context_t con)
{
- if (0 != _setfilecon && is_selinux_enabled())
+ if (nullptr != _setfilecon && is_selinux_enabled())
return _setfilecon(path, con);
return 0;
}
int matchpathcon_init(const char *path)
{
- if (0 != _matchpathcon_init && is_selinux_enabled())
+ if (nullptr != _matchpathcon_init && is_selinux_enabled())
return _matchpathcon_init(path);
return 0;
}
@@ -135,7 +135,7 @@ namespace
int is_selinux_enabled()
{
// Assume that if this returns an error we can't effectively use selinux.
- if (0 != _is_selinux_enabled)
+ if (nullptr != _is_selinux_enabled)
return _is_selinux_enabled() > 0 ? 1 : 0;
return 0;
}
@@ -155,13 +155,13 @@ namespace paludis
~Imp()
{
- if (0 != _context)
+ if (nullptr != _context)
libselinux.freecon(_context);
}
void set(security_context_t newcon)
{
- if (0 != _context)
+ if (nullptr != _context)
libselinux.freecon(_context);
_context = newcon;
@@ -170,7 +170,7 @@ namespace paludis
}
SecurityContext::SecurityContext() :
- _imp(security_context_t(0))
+ _imp(security_context_t(nullptr))
{
}
@@ -219,7 +219,7 @@ FSCreateCon::~FSCreateCon()
MatchPathCon::MatchPathCon()
{
- if (0 != libselinux.matchpathcon_init(0))
+ if (0 != libselinux.matchpathcon_init(nullptr))
{
_good=false;
// throw SELinuxException("Failed running matchpathcon_init.");
diff --git a/paludis/util/buffer_output_stream.cc b/paludis/util/buffer_output_stream.cc
index 9c321c9..46b97a3 100644
--- a/paludis/util/buffer_output_stream.cc
+++ b/paludis/util/buffer_output_stream.cc
@@ -44,7 +44,7 @@ namespace paludis
BufferOutputStreamBuf::BufferOutputStreamBuf() :
_imp()
{
- setg(0, 0, 0);
+ setg(nullptr, nullptr, nullptr);
}
BufferOutputStreamBuf::~BufferOutputStreamBuf()
diff --git a/paludis/util/config_file_TEST.cc b/paludis/util/config_file_TEST.cc
index d6c102b..8b9dcf2 100644
--- a/paludis/util/config_file_TEST.cc
+++ b/paludis/util/config_file_TEST.cc
@@ -141,14 +141,14 @@ TEST(LineConfigFile, Open)
FSPath ff2("config_file_TEST_dir/not_a_config_file");
EXPECT_TRUE(! ff2.stat().exists());
- LineConfigFile * PALUDIS_ATTRIBUTE((unused)) f2(0);
+ LineConfigFile * PALUDIS_ATTRIBUTE((unused)) f2(nullptr);
EXPECT_THROW(f2 = new LineConfigFile(ff2, { }), ConfigFileError);
if (0 != geteuid())
{
FSPath ff3("config_file_TEST_dir/unreadable_file");
EXPECT_TRUE(ff3.stat().is_regular_file());
- LineConfigFile * PALUDIS_ATTRIBUTE((unused)) f3(0);
+ LineConfigFile * PALUDIS_ATTRIBUTE((unused)) f3(nullptr);
EXPECT_THROW(f3 = new LineConfigFile(ff3, { }), ConfigFileError);
}
}
diff --git a/paludis/util/cookie.cc b/paludis/util/cookie.cc
index f9ae3ab..ff3a1c6 100644
--- a/paludis/util/cookie.cc
+++ b/paludis/util/cookie.cc
@@ -29,7 +29,7 @@ std::string
paludis::cookie()
{
struct timeval t;
- gettimeofday(&t, 0);
+ gettimeofday(&t, nullptr);
return "C." + stringify(::getpid()) + "." + stringify(t.tv_sec) + "." + stringify(t.tv_usec) + ".C";
}
diff --git a/paludis/util/exception.cc b/paludis/util/exception.cc
index d0ce9d2..c6908ea 100644
--- a/paludis/util/exception.cc
+++ b/paludis/util/exception.cc
@@ -147,7 +147,7 @@ Exception::what() const noexcept
{
int status(0);
char * const name(abi::__cxa_demangle(
- (std::string("_Z") + typeid(*this).name()).c_str(), 0, 0, &status));
+ (std::string("_Z") + typeid(*this).name()).c_str(), nullptr, nullptr, &status));
if (0 == status)
{
diff --git a/paludis/util/fs_iterator.cc b/paludis/util/fs_iterator.cc
index b4fd309..b184514 100644
--- a/paludis/util/fs_iterator.cc
+++ b/paludis/util/fs_iterator.cc
@@ -79,14 +79,14 @@ FSIterator::FSIterator(const FSPath & base, const FSIteratorOptions & options) :
_imp->items = std::make_shared<EntrySet>(&compare_name);
DIR * d(opendir(stringify(base).c_str()));
- if (0 == d)
+ if (nullptr == d)
throw FSError("Error opening directory '" + stringify(base) + "': " + stringify(::strerror(errno)));
bool have_any_special_wants(options[fsio_want_directories] || options[fsio_want_regular_files]);
struct dirent * de;
bool done(false);
- while (0 != ((de = readdir(d))))
+ while (nullptr != ((de = readdir(d))))
{
if (done)
break;
diff --git a/paludis/util/log.cc b/paludis/util/log.cc
index 1a0b764..fb8d385 100644
--- a/paludis/util/log.cc
+++ b/paludis/util/log.cc
@@ -60,7 +60,7 @@ namespace paludis
{
if (l >= log_level)
{
- *stream << program_name << "@" << ::time(0) << ": ";
+ *stream << program_name << "@" << ::time(nullptr) << ": ";
do
{
switch (l)
diff --git a/paludis/util/pty.cc b/paludis/util/pty.cc
index 754fdad..e5ac7ed 100644
--- a/paludis/util/pty.cc
+++ b/paludis/util/pty.cc
@@ -78,7 +78,7 @@ Pty::Pty(const bool close_exec, const unsigned short columns, const unsigned sho
_fds[1] = open(&name[0], O_WRONLY | O_NOCTTY | (close_exec ? O_CLOEXEC : 0));
#else
const char * name(ptsname(_fds[0]));
- if (0 == name)
+ if (nullptr == name)
{
close(_fds[0]);
throw PtyError("ptsname(3) failed: " + std::string(std::strerror(errno)));
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 5ec79cc..39736d5 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -1394,7 +1394,7 @@ namespace
a_end(constraint->spec().if_package()->additional_requirements_ptr()->end()) ;
a != a_end ; ++a)
{
- const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), 0, u->package_id(), constraint->from_id(), 0));
+ const std::pair<bool, std::string> p((*a)->requirement_met(env.get(), nullptr, u->package_id(), constraint->from_id(), nullptr));
if (p.first)
continue;