aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-23 21:14:33 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-23 21:15:08 +0100
commit1e88d3f531a7d9cac4cd08db1484a3a87679af3c (patch)
tree9c2852177fbfc30366d24947658bf52a5c9e6d0c /ruby
parentc3802f0aec7d89a518cf74145aa73bf2ea688e35 (diff)
downloadpaludis-1e88d3f531a7d9cac4cd08db1484a3a87679af3c.tar.gz
paludis-1e88d3f531a7d9cac4cd08db1484a3a87679af3c.tar.xz
Avoid more explicit newage
Diffstat (limited to 'ruby')
-rw-r--r--ruby/action.cc9
-rw-r--r--ruby/contents.cc6
-rw-r--r--ruby/dep_list.cc10
-rw-r--r--ruby/dep_spec.cc32
-rw-r--r--ruby/dep_tag.cc8
-rw-r--r--ruby/environment.cc8
-rw-r--r--ruby/repository.cc2
7 files changed, 37 insertions, 38 deletions
diff --git a/ruby/action.cc b/ruby/action.cc
index 824e4e7e2..b84327f7d 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -285,7 +285,7 @@ namespace
{
const FetchActionOptions opts_ptr(value_to_fetch_action_options(opts));
std::shared_ptr<Action> * a(
- new std::shared_ptr<Action>(new FetchAction(opts_ptr)));
+ new std::shared_ptr<Action>(std::make_shared<FetchAction>(opts_ptr)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Action> >::free, a));
rb_obj_call_init(tdata, 1, &self);
return tdata;
@@ -476,7 +476,7 @@ namespace
n::make_output_manager() = &make_standard_output_manager
));
- std::shared_ptr<Action> * a(new std::shared_ptr<Action>(new A_(options)));
+ std::shared_ptr<Action> * a(new std::shared_ptr<Action>(std::make_shared<A_>(options)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Action> >::free, a));
rb_obj_call_init(tdata, 1, &self);
return tdata;
@@ -573,7 +573,7 @@ namespace
{
const InstallActionOptions opts_ptr(value_to_install_action_options(opts));
std::shared_ptr<Action> * a(
- new std::shared_ptr<Action>(new InstallAction(opts_ptr)));
+ new std::shared_ptr<Action>(std::make_shared<InstallAction>(opts_ptr)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Action> >::free, a));
rb_obj_call_init(tdata, 1, &self);
return tdata;
@@ -648,8 +648,7 @@ namespace
uninstall_action_new(VALUE self, VALUE opts)
{
const UninstallActionOptions opts_ptr(value_to_uninstall_action_options(opts));
- std::shared_ptr<Action> * a(
- new std::shared_ptr<Action>(new UninstallAction(opts_ptr)));
+ std::shared_ptr<Action> * a(new std::shared_ptr<Action>(std::make_shared<UninstallAction>(opts_ptr)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Action> >::free, a));
rb_obj_call_init(tdata, 1, &self);
return tdata;
diff --git a/ruby/contents.cc b/ruby/contents.cc
index 2753aaed6..10caa1f47 100644
--- a/ruby/contents.cc
+++ b/ruby/contents.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2006, 2007 Richard Brown
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -173,7 +173,7 @@ namespace
{
if (1 == argc)
{
- ptr = new std::shared_ptr<const ContentsEntry>(new A_(
+ ptr = new std::shared_ptr<const ContentsEntry>(std::make_shared<A_>(
FSEntry(StringValuePtr(argv[0]))));
}
else
@@ -199,7 +199,7 @@ namespace
{
if (2 == argc)
{
- ptr = new std::shared_ptr<const ContentsEntry>(new ContentsSymEntry(
+ ptr = new std::shared_ptr<const ContentsEntry>(std::make_shared<ContentsSymEntry>(
FSEntry(StringValuePtr(argv[0])), StringValuePtr(argv[1])));
}
else
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index 60c2d7346..b64d6fb85 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -133,7 +133,7 @@ namespace
std::shared_ptr<DepListOverrideMasksFunctions> * ptr(0);
try
{
- ptr = new std::shared_ptr<DepListOverrideMasksFunctions>(new DepListOverrideMasksFunctions);
+ ptr = new std::shared_ptr<DepListOverrideMasksFunctions>(std::make_shared<DepListOverrideMasksFunctions>());
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<DepListOverrideMasksFunctions> >::free, ptr));
rb_obj_call_init(tdata, argc, argv);
return tdata;
@@ -194,7 +194,7 @@ namespace
{
try
{
- ptr = new std::shared_ptr<DepListOptions>(new DepListOptions);
+ ptr = new std::shared_ptr<DepListOptions>(std::make_shared<DepListOptions>());
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<DepListOptions> >::free, ptr));
rb_obj_call_init(tdata, argc, argv);
return tdata;
@@ -382,7 +382,7 @@ namespace
if (value_for_circular < 0 || value_for_blocks >= last_dl_blocks)
rb_raise(rb_eArgError, "blocks out of range");
- ptr = new std::shared_ptr<DepListOptions>(new DepListOptions);
+ ptr = new std::shared_ptr<DepListOptions>(std::make_shared<DepListOptions>());
(*ptr)->blocks() = static_cast<DepListBlocksOption>(value_for_blocks);
(*ptr)->circular() = static_cast<DepListCircularOption>(value_for_circular);
(*ptr)->dependency_tags() = value_for_dependency_tags;
@@ -915,7 +915,7 @@ namespace
Data_Get_Struct(self, DepList, p);
if (!rb_obj_is_kind_of(d, rb_cArray))
rb_raise(rb_eTypeError, "Can't convert %s into Array", rb_obj_classname(d));
- std::shared_ptr<DestinationsSet> destinations(new DestinationsSet);
+ std::shared_ptr<DestinationsSet> destinations(std::make_shared<DestinationsSet>());
for (long i = 0 ; i < RARRAY_LEN(d) ; ++i)
destinations->insert(value_to_repository(rb_ary_entry(d, i)));
@@ -975,7 +975,7 @@ namespace
Data_Get_Struct(self, DepList, p);
if (!rb_obj_is_kind_of(d, rb_cArray))
rb_raise(rb_eTypeError, "Can't convert %s into Array", rb_obj_classname(d));
- std::shared_ptr<DestinationsCollection> destinations(new DestinationsCollection::Concrete);
+ std::shared_ptr<DestinationsCollection> destinations(std::make_shared<DestinationsCollection::Concrete>());
for (long i = 0 ; i < RARRAY_LEN(d) ; ++i)
destinations->insert(value_to_repository(rb_ary_entry(d, i)));
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 1f180e1d5..65daf6bae 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -187,61 +187,61 @@ namespace
void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<PackageDepSpec>>(std::static_pointer_cast<PackageDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<PackageDepSpec>(std::static_pointer_cast<PackageDepSpec>(node.spec()->clone())));
klass = c_package_dep_spec;
}
void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<BlockDepSpec>>(std::static_pointer_cast<BlockDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<BlockDepSpec>(std::static_pointer_cast<BlockDepSpec>(node.spec()->clone())));
klass = c_block_dep_spec;
}
void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<PlainTextDepSpec>>(std::static_pointer_cast<PlainTextDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<PlainTextDepSpec>(std::static_pointer_cast<PlainTextDepSpec>(node.spec()->clone())));
klass = c_plain_text_dep_spec;
}
void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<SimpleURIDepSpec>>(std::static_pointer_cast<SimpleURIDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<SimpleURIDepSpec>(std::static_pointer_cast<SimpleURIDepSpec>(node.spec()->clone())));
klass = c_simple_uri_dep_spec;
}
void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<FetchableURIDepSpec>>(std::static_pointer_cast<FetchableURIDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<FetchableURIDepSpec>(std::static_pointer_cast<FetchableURIDepSpec>(node.spec()->clone())));
klass = c_fetchable_uri_dep_spec;
}
void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<URILabelsDepSpec>>(std::static_pointer_cast<URILabelsDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<URILabelsDepSpec>(std::static_pointer_cast<URILabelsDepSpec>(node.spec()->clone())));
klass = c_uri_labels_dep_spec;
}
void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<PlainTextLabelDepSpec>>(std::static_pointer_cast<PlainTextLabelDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<PlainTextLabelDepSpec>(std::static_pointer_cast<PlainTextLabelDepSpec>(node.spec()->clone())));
klass = c_plain_text_label_dep_spec;
}
void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<DependenciesLabelsDepSpec>>(std::static_pointer_cast<DependenciesLabelsDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<DependenciesLabelsDepSpec>(std::static_pointer_cast<DependenciesLabelsDepSpec>(node.spec()->clone())));
klass = c_dependencies_labels_dep_spec;
}
void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<NamedSetDepSpec>>(std::static_pointer_cast<NamedSetDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<NamedSetDepSpec>(std::static_pointer_cast<NamedSetDepSpec>(node.spec()->clone())));
klass = c_named_set_dep_spec;
}
void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node)
{
- wrapped = std::make_shared<WrappedSpec<LicenseDepSpec>>(std::static_pointer_cast<LicenseDepSpec>(node.spec()->clone()));
+ wrapped.reset(new WrappedSpec<LicenseDepSpec>(std::static_pointer_cast<LicenseDepSpec>(node.spec()->clone())));
klass = c_license_dep_spec;
}
@@ -354,7 +354,7 @@ namespace
{
static void handle(ValueToTree<H_> * const t, const WrappedSpec<AllDepSpec> & spec)
{
- t->result = std::make_shared<H_>(spec.spec());
+ t->result.reset(new H_(spec.spec()));
t->add_to = t->result->root();
}
};
@@ -469,7 +469,7 @@ namespace
try
{
std::shared_ptr<const PackageDepSpec> pkg(value_to_package_dep_spec(spec));
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<BlockDepSpec>(
+ ptr = new std::shared_ptr<const WrappedSpecBase>(std::make_shared<WrappedSpec<BlockDepSpec>>(
std::make_shared<BlockDepSpec>(StringValuePtr(str), *pkg, value_to_bool(strong))));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const WrappedSpecBase> >::free, ptr));
rb_obj_call_init(tdata, 3, &str);
@@ -506,7 +506,7 @@ namespace
std::shared_ptr<const WrappedSpecBase> * ptr(0);
try
{
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<A_>(std::make_shared<A_>()));
+ ptr = new std::shared_ptr<const WrappedSpecBase>(std::make_shared<WrappedSpec<A_>>(std::make_shared<A_>()));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const WrappedSpecBase> >::free, ptr));
rb_obj_call_init(tdata, 0, &self);
return tdata;
@@ -524,7 +524,7 @@ namespace
std::shared_ptr<const WrappedSpecBase> * ptr(0);
try
{
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<A_>(std::make_shared<A_>(StringValuePtr(s))));
+ ptr = new std::shared_ptr<const WrappedSpecBase>(std::make_shared<WrappedSpec<A_>>(std::make_shared<A_>(StringValuePtr(s))));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const WrappedSpecBase> >::free, ptr));
rb_obj_call_init(tdata, 1, &s);
return tdata;
@@ -1058,7 +1058,7 @@ namespace
filter::All()
);
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<PackageDepSpec>(
+ ptr = new std::shared_ptr<const WrappedSpecBase>(std::make_shared<WrappedSpec<PackageDepSpec>>(
std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(s, e.get(), o, f))));
return Data_Wrap_Struct(c_package_dep_spec, 0,
&Common<std::shared_ptr<const WrappedSpecBase> >::free, ptr);
@@ -1402,7 +1402,7 @@ VALUE
paludis::ruby::package_dep_spec_to_value(const std::shared_ptr<const PackageDepSpec> & p)
{
std::shared_ptr<const WrappedSpecBase> * v_ptr(new std::shared_ptr<const WrappedSpecBase>(
- new WrappedSpec<PackageDepSpec>(std::static_pointer_cast<PackageDepSpec>(p->clone()))));
+ std::make_shared<WrappedSpec<PackageDepSpec>>(std::static_pointer_cast<PackageDepSpec>(p->clone()))));
return Data_Wrap_Struct(c_package_dep_spec, 0, &Common<std::shared_ptr<const WrappedSpecBase> >::free, v_ptr);
}
diff --git a/ruby/dep_tag.cc b/ruby/dep_tag.cc
index d662e69d9..e0d971616 100644
--- a/ruby/dep_tag.cc
+++ b/ruby/dep_tag.cc
@@ -85,7 +85,7 @@ namespace
try
{
ptr = new std::shared_ptr<const DepTag>(
- new DependencyDepTag(value_to_package_id(argv[0]),
+ std::make_shared<DependencyDepTag>(value_to_package_id(argv[0]),
*value_to_package_dep_spec(argv[1])));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr));
rb_obj_call_init(tdata, argc, argv);
@@ -135,7 +135,7 @@ namespace
std::shared_ptr<const DepTag> * ptr(0);
try
{
- ptr = new std::shared_ptr<const DepTag>(new GLSADepTag(StringValuePtr(argv[0]), StringValuePtr(argv[1]),
+ ptr = new std::shared_ptr<const DepTag>(std::make_shared<GLSADepTag>(StringValuePtr(argv[0]), StringValuePtr(argv[1]),
FSEntry(StringValuePtr(argv[2]))));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr));
rb_obj_call_init(tdata, argc, argv);
@@ -157,7 +157,7 @@ namespace
std::shared_ptr<const DepTag> * ptr(0);
try
{
- ptr = new std::shared_ptr<const DepTag>(new GeneralSetDepTag(SetName(StringValuePtr(argv[0])), StringValuePtr(argv[1])));
+ ptr = new std::shared_ptr<const DepTag>(std::make_shared<GeneralSetDepTag>(SetName(StringValuePtr(argv[0])), StringValuePtr(argv[1])));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr));
rb_obj_call_init(tdata, argc, argv);
return tdata;
@@ -175,7 +175,7 @@ namespace
std::shared_ptr<const DepTag> * ptr(0);
try
{
- ptr = new std::shared_ptr<const DepTag>(new TargetDepTag);
+ ptr = new std::shared_ptr<const DepTag>(std::make_shared<TargetDepTag>());
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<const DepTag> >::free, ptr));
rb_obj_call_init(tdata, 0, 0);
return tdata;
diff --git a/ruby/environment.cc b/ruby/environment.cc
index c519d953a..75c92ee61 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -143,7 +143,7 @@ namespace
{
try
{
- std::shared_ptr<KeywordNameSet> knc (new KeywordNameSet);
+ std::shared_ptr<KeywordNameSet> knc (std::make_shared<KeywordNameSet>());
long len = NUM2LONG(rb_funcall(keywords,rb_intern("length"),0));
for (long i = 0; i < len; i++)
{
@@ -276,7 +276,7 @@ namespace
else if (0 != argc)
rb_raise(rb_eArgError, "PaludisEnvironment.new expects one or zero arguments, but got %d", argc);
- std::shared_ptr<Environment> * e = new std::shared_ptr<Environment>(new PaludisEnvironment(config_suffix));
+ std::shared_ptr<Environment> * e = new std::shared_ptr<Environment>(std::make_shared<PaludisEnvironment>(config_suffix));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Environment> >::free, e));
rb_obj_call_init(tdata, argc, argv);
return tdata;
@@ -298,7 +298,7 @@ namespace
{
try
{
- std::shared_ptr<Environment> * e = new std::shared_ptr<Environment>(new TestEnvironment);
+ std::shared_ptr<Environment> * e = new std::shared_ptr<Environment>(std::make_shared<TestEnvironment>());
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<std::shared_ptr<Environment> >::free, e));
rb_obj_call_init(tdata, 0, &self);
return tdata;
@@ -343,7 +343,7 @@ namespace
try
{
std::string write_cache, master_repository_name;
- std::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence);
+ std::shared_ptr<FSEntrySequence> extra_repository_dirs(std::make_shared<FSEntrySequence>());
if (1 == argc)
{
write_cache = "/var/empty/";
diff --git a/ruby/repository.cc b/ruby/repository.cc
index ff5d09060..ef58486d7 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -497,7 +497,7 @@ namespace
if (2 != argc)
rb_raise(rb_eArgError, "FakeRepository.new expects two arguments, but got %d", argc);
- std::shared_ptr<Repository> * r = new std::shared_ptr<Repository>(new FakeRepository(
+ std::shared_ptr<Repository> * r = new std::shared_ptr<Repository>(std::make_shared<FakeRepository>(
make_named_values<FakeRepositoryParams>(
n::environment() = value_to_environment(argv[0]).get(),
n::name() = RepositoryName(StringValuePtr(argv[1])))));