aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/virtuals
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-22 12:52:10 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-22 18:55:26 +0100
commitf7be9952e67a5cdad6f3531a22654db198e7d106 (patch)
tree54c8fae2eaaf89851c038d28ed6deb9096c87b4d /paludis/repositories/virtuals
parent84f32a46c9bd03039af31be9626206ce891fa841 (diff)
downloadpaludis-f7be9952e67a5cdad6f3531a22654db198e7d106.tar.gz
paludis-f7be9952e67a5cdad6f3531a22654db198e7d106.tar.xz
Use std::make_shared<>
Diffstat (limited to 'paludis/repositories/virtuals')
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc12
-rw-r--r--paludis/repositories/virtuals/package_id.cc26
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc14
-rw-r--r--paludis/repositories/virtuals/virtuals_repository_TEST.cc29
4 files changed, 40 insertions, 41 deletions
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 981517f41..614114ad0 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -25,7 +25,6 @@
#include <paludis/package_database.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
@@ -36,6 +35,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <functional>
#include <unordered_map>
@@ -61,7 +61,7 @@ namespace paludis
std::shared_ptr<const MetadataValueKey<FSEntry> > root_key;
std::shared_ptr<const MetadataValueKey<std::string> > format_key;
- Implementation(const Environment * const e, const FSEntry & r, std::shared_ptr<Mutex> m = make_shared_ptr(new Mutex)) :
+ Implementation(const Environment * const e, const FSEntry & r, std::shared_ptr<Mutex> m = std::make_shared<Mutex>()) :
env(e),
root(r),
ids_mutex(m),
@@ -154,7 +154,7 @@ InstalledVirtualsRepository::need_ids() const
{
IDMap::iterator i(_imp->ids.find((*p).virtual_name()));
if (i == _imp->ids.end())
- i = _imp->ids.insert(std::make_pair((*p).virtual_name(), make_shared_ptr(new PackageIDSequence))).first;
+ i = _imp->ids.insert(std::make_pair((*p).virtual_name(), std::make_shared<PackageIDSequence>())).first;
std::shared_ptr<const PackageID> id(new virtuals::VirtualsPackageID(
_imp->env, shared_from_this(), (*p).virtual_name(), (*p).provided_by(), false));
@@ -309,7 +309,7 @@ InstalledVirtualsRepository::some_ids_might_not_be_masked() const
std::shared_ptr<const CategoryNamePartSet>
InstalledVirtualsRepository::unimportant_category_names() const
{
- std::shared_ptr<CategoryNamePartSet> result(make_shared_ptr(new CategoryNamePartSet));
+ std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
result->insert(CategoryNamePart("virtual"));
return result;
}
@@ -353,7 +353,7 @@ InstalledVirtualsRepository::repository_factory_create(
if (f("root").empty())
throw ConfigurationError("Key 'root' unspecified or empty");
- return make_shared_ptr(new InstalledVirtualsRepository(env, f("root")));
+ return std::make_shared<InstalledVirtualsRepository>(env, f("root"));
}
std::shared_ptr<const RepositoryNameSet>
@@ -361,7 +361,7 @@ InstalledVirtualsRepository::repository_factory_dependencies(
const Environment * const,
const std::function<std::string (const std::string &)> &)
{
- return make_shared_ptr(new RepositoryNameSet);
+ return std::make_shared<RepositoryNameSet>();
}
bool
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 90a1b12c6..de93cc4f7 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -21,12 +21,12 @@
#include <paludis/repositories/virtuals/installed_virtuals_repository.hh>
#include <paludis/repositories/virtuals/virtuals_repository.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/return_literal_function.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
#include <paludis/version_spec.hh>
@@ -64,23 +64,23 @@ namespace paludis
const std::shared_ptr<const DependenciesLabelSequence> & l,
bool exact, const std::string & h, const std::string & r) :
env(e),
- value(new DependencySpecTree(make_shared_ptr(new AllDepSpec))),
+ value(new DependencySpecTree(std::make_shared<AllDepSpec>())),
labels(l),
spec(exact ?
- make_shared_ptr(new PackageDepSpec(
+ std::make_shared<PackageDepSpec>(
make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
.package(v->name())
.version_requirement(make_named_values<VersionRequirement>(
n::version_operator() = vo_equal,
n::version_spec() = v->version()))
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(
- v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN"))))
- .in_repository(v->repository()->name())))
+ .slot_requirement(std::make_shared<UserSlotExactRequirement>(
+ v->slot_key() ? v->slot_key()->value() : SlotName("UNKNOWN")))
+ .in_repository(v->repository()->name()))
:
- make_shared_ptr(new PackageDepSpec(
+ std::make_shared<PackageDepSpec>(
make_package_dep_spec(PartiallyMadePackageDepSpecOptions())
.package(v->name())
- ))
+ )
),
raw_name(r),
human_name(h)
@@ -191,10 +191,10 @@ namespace paludis
rdep(new virtuals::VirtualsDepKey(e, "RDEPEND", "Run dependencies", p, rdep_labels, b)),
has_masks(false)
{
- bdep_labels->push_back(make_shared_ptr(new DependenciesBuildLabel("DEPEND",
- return_literal_function(true))));
- rdep_labels->push_back(make_shared_ptr(new DependenciesRunLabel("RDEPEND",
- return_literal_function(true))));
+ bdep_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND",
+ return_literal_function(true)));
+ rdep_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND",
+ return_literal_function(true)));
}
};
}
@@ -498,7 +498,7 @@ VirtualsPackageID::need_masks_added() const
return;
if (_imp->virtual_for->value()->masked())
- add_mask(make_shared_ptr(new VirtualsAssociationMask(_imp->virtual_for->value())));
+ add_mask(std::make_shared<VirtualsAssociationMask>(_imp->virtual_for->value()));
_imp->has_masks = true;
}
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index e680ae502..4b2d84b57 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -32,7 +32,6 @@
#include <paludis/hook.hh>
#include <paludis/util/log.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/operators.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/map.hh>
@@ -43,6 +42,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <functional>
#include <unordered_map>
@@ -71,7 +71,7 @@ namespace paludis
std::shared_ptr<const MetadataValueKey<std::string> > format_key;
- Implementation(const Environment * const e, std::shared_ptr<Mutex> m = make_shared_ptr(new Mutex)) :
+ Implementation(const Environment * const e, std::shared_ptr<Mutex> m = std::make_shared<Mutex>()) :
env(e),
big_nasty_mutex(m),
has_names(false),
@@ -236,7 +236,7 @@ VirtualsRepository::need_ids() const
{
IDMap::iterator i(my_ids.find(v->first));
if (my_ids.end() == i)
- i = my_ids.insert(std::make_pair(v->first, make_shared_ptr(new PackageIDSequence))).first;
+ i = my_ids.insert(std::make_pair(v->first, std::make_shared<PackageIDSequence>())).first;
std::shared_ptr<const PackageID> id(make_virtual_package_id(QualifiedPackageName(v->first), *m));
if (stringify(id->name().category()) != "virtual")
@@ -337,7 +337,7 @@ VirtualsRepository::make_virtual_package_id(
throw InternalError(PALUDIS_HERE, "tried to make a virtual package id using '" + stringify(virtual_name) + "', '"
+ stringify(*provider) + "'");
- return make_shared_ptr(new virtuals::VirtualsPackageID(_imp->env, shared_from_this(), virtual_name, provider, true));
+ return std::make_shared<virtuals::VirtualsPackageID>(_imp->env, shared_from_this(), virtual_name, provider, true);
}
bool
@@ -409,7 +409,7 @@ VirtualsRepository::some_ids_might_not_be_masked() const
std::shared_ptr<const CategoryNamePartSet>
VirtualsRepository::unimportant_category_names() const
{
- std::shared_ptr<CategoryNamePartSet> result(make_shared_ptr(new CategoryNamePartSet));
+ std::shared_ptr<CategoryNamePartSet> result(std::make_shared<CategoryNamePartSet>());
result->insert(CategoryNamePart("virtual"));
return result;
}
@@ -450,7 +450,7 @@ VirtualsRepository::repository_factory_create(
const Environment * const env,
const std::function<std::string (const std::string &)> &)
{
- return make_shared_ptr(new VirtualsRepository(env));
+ return std::make_shared<VirtualsRepository>(env);
}
std::shared_ptr<const RepositoryNameSet>
@@ -458,7 +458,7 @@ VirtualsRepository::repository_factory_dependencies(
const Environment * const,
const std::function<std::string (const std::string &)> &)
{
- return make_shared_ptr(new RepositoryNameSet);
+ return std::make_shared<RepositoryNameSet>();
}
void
diff --git a/paludis/repositories/virtuals/virtuals_repository_TEST.cc b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
index 11d574f0c..e7aece21f 100644
--- a/paludis/repositories/virtuals/virtuals_repository_TEST.cc
+++ b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
@@ -33,7 +33,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/user_dep_spec.hh>
@@ -71,8 +70,8 @@ namespace test_cases
repo->add_version("cat", "pkg", "1")->provide_key()->set_from_string("virtual/pkg");
repo->add_version("cat", "pkg", "2")->provide_key()->set_from_string("virtual/pkg");
- repo->add_virtual_package(QualifiedPackageName("virtual/pkg"), make_shared_ptr(new PackageDepSpec(
- parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions()))));
+ repo->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions())));
TEST_CHECK(repo->virtual_packages());
TEST_CHECK_EQUAL(std::distance(repo->virtual_packages()->begin(), repo->virtual_packages()->end()), 1);
@@ -117,15 +116,15 @@ namespace test_cases
repo1->add_version("cat", "pkg", "1")->provide_key()->set_from_string("virtual/pkg");
repo1->add_version("cat", "pkg", "2")->provide_key()->set_from_string("virtual/pkg");
- repo1->add_virtual_package(QualifiedPackageName("virtual/pkg"), make_shared_ptr(
- new PackageDepSpec(parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions()))));
- repo1->add_virtual_package(QualifiedPackageName("virtual/foo"), make_shared_ptr(
- new PackageDepSpec(parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions()))));
+ repo1->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions())));
+ repo1->add_virtual_package(QualifiedPackageName("virtual/foo"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions())));
- repo2->add_virtual_package(QualifiedPackageName("virtual/pkg"), make_shared_ptr(new PackageDepSpec(
- parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions()))));
- repo2->add_virtual_package(QualifiedPackageName("virtual/foo"), make_shared_ptr(new PackageDepSpec(
- parse_user_package_dep_spec("<=cat/pkg-1", &env, UserPackageDepSpecOptions()))));
+ repo2->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec(">=cat/pkg-2", &env, UserPackageDepSpecOptions())));
+ repo2->add_virtual_package(QualifiedPackageName("virtual/foo"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec("<=cat/pkg-1", &env, UserPackageDepSpecOptions())));
TEST_CHECK(virtuals->has_category_named(CategoryNamePart("virtual")));
TEST_CHECK(virtuals->has_package_named(QualifiedPackageName("virtual/pkg")));
@@ -161,12 +160,12 @@ namespace test_cases
env.package_database()->add_repository(4, virtuals);
repo1->add_version("virtual", "gkp", "1")->provide_key()->set_from_string("virtual/pkg");
- repo1->add_virtual_package(QualifiedPackageName("virtual/pkg"), make_shared_ptr(
- new PackageDepSpec(parse_user_package_dep_spec("virtual/gkp", &env, UserPackageDepSpecOptions()))));
+ repo1->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec("virtual/gkp", &env, UserPackageDepSpecOptions())));
repo2->add_version("virtual", "pkg", "2")->provide_key()->set_from_string("virtual/pkg");
- repo2->add_virtual_package(QualifiedPackageName("virtual/pkg"), make_shared_ptr(new PackageDepSpec(
- parse_user_package_dep_spec("virtual/pkg", &env, UserPackageDepSpecOptions()))));
+ repo2->add_virtual_package(QualifiedPackageName("virtual/pkg"), std::make_shared<PackageDepSpec>(
+ parse_user_package_dep_spec("virtual/pkg", &env, UserPackageDepSpecOptions())));
TEST_CHECK(virtuals->has_category_named(CategoryNamePart("virtual")));
TEST_CHECK(virtuals->has_package_named(QualifiedPackageName("virtual/pkg")));