aboutsummaryrefslogtreecommitdiff
path: root/ruby
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 /ruby
parent84f32a46c9bd03039af31be9626206ce891fa841 (diff)
downloadpaludis-f7be9952e67a5cdad6f3531a22654db198e7d106.tar.gz
paludis-f7be9952e67a5cdad6f3531a22654db198e7d106.tar.xz
Use std::make_shared<>
Diffstat (limited to 'ruby')
-rw-r--r--ruby/action.cc22
-rw-r--r--ruby/dep_label.cc3
-rw-r--r--ruby/dep_spec.cc18
3 files changed, 21 insertions, 22 deletions
diff --git a/ruby/action.cc b/ruby/action.cc
index 671d643e1..824e4e7e2 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -20,9 +20,9 @@
#include <paludis_ruby.hh>
#include <paludis/action.hh>
-#include <paludis/util/make_shared_ptr.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/standard_output_manager.hh>
#include <ruby.h>
@@ -178,19 +178,19 @@ namespace
try
{
if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, install_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<InstallAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<InstallAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, uninstall_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<UninstallAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<UninstallAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, pretend_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<PretendAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<PretendAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, config_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<ConfigAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<ConfigAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, fetch_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<FetchAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<FetchAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, info_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<InfoAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<InfoAction>>());
else if (Qtrue == rb_funcall2(action_class, rb_intern("<="), 1, pretend_fetch_action_value_ptr()))
- ptr = new std::shared_ptr<const SupportsActionTestBase>(make_shared_ptr(new SupportsActionTest<PretendFetchAction>()));
+ ptr = new std::shared_ptr<const SupportsActionTestBase>(std::make_shared<SupportsActionTest<PretendFetchAction>>());
else
rb_raise(rb_eTypeError, "Can't convert %s into an Action subclass", rb_obj_classname(action_class));
@@ -207,7 +207,7 @@ namespace
std::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
{
- return make_shared_ptr(new StandardOutputManager);
+ return std::make_shared<StandardOutputManager>();
}
/*
@@ -255,7 +255,7 @@ namespace
parts += fp_unneeded;
ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
- n::errors() = make_shared_ptr(new Sequence<FetchActionFailure>),
+ n::errors() = std::make_shared<Sequence<FetchActionFailure>>(),
n::exclude_unmirrorable() = v_exclude_unmirrorable,
n::fetch_parts() = parts,
n::ignore_not_in_manifest() = false,
@@ -531,7 +531,7 @@ namespace
n::destination() = v_destination,
n::make_output_manager() = &make_standard_output_manager,
n::perform_uninstall() = &cannot_perform_uninstall,
- n::replacing() = make_shared_ptr(new PackageIDSequence),
+ n::replacing() = std::make_shared<PackageIDSequence>(),
n::want_phase() = &want_all_phases
));
diff --git a/ruby/dep_label.cc b/ruby/dep_label.cc
index 949696be3..e202ab28f 100644
--- a/ruby/dep_label.cc
+++ b/ruby/dep_label.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
* Copyright (c) 2006, 2007, 2008 Richard Brown
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -22,7 +22,6 @@
#include <paludis/dep_list.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/save.hh>
#include <paludis/util/member_iterator-impl.hh>
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index dc6ceb385..668f5b749 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -25,11 +25,11 @@
#include <paludis/version_operator.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/save.hh>
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <list>
#include <ruby.h>
@@ -469,8 +469,8 @@ namespace
try
{
std::shared_ptr<const PackageDepSpec> pkg(value_to_package_dep_spec(spec));
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<BlockDepSpec>(make_shared_ptr(
- new BlockDepSpec(StringValuePtr(str), *pkg, value_to_bool(strong)))));
+ ptr = new std::shared_ptr<const WrappedSpecBase>(new 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);
return tdata;
@@ -493,8 +493,8 @@ namespace
{
std::shared_ptr<WrappedSpecBase> * p;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, p);
- return package_dep_spec_to_value(make_shared_ptr(new PackageDepSpec(
- std::static_pointer_cast<const WrappedSpec<BlockDepSpec> >(*p)->spec()->blocking())));
+ return package_dep_spec_to_value(std::make_shared<PackageDepSpec>(
+ std::static_pointer_cast<const WrappedSpec<BlockDepSpec> >(*p)->spec()->blocking()));
}
template <typename A_>
@@ -506,7 +506,7 @@ namespace
std::shared_ptr<const WrappedSpecBase> * ptr(0);
try
{
- ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<A_>(make_shared_ptr(new A_)));
+ ptr = new std::shared_ptr<const WrappedSpecBase>(new 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_>(make_shared_ptr(new A_(StringValuePtr(s)))));
+ ptr = new std::shared_ptr<const WrappedSpecBase>(new 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;
@@ -1059,7 +1059,7 @@ namespace
);
ptr = new std::shared_ptr<const WrappedSpecBase>(new WrappedSpec<PackageDepSpec>(
- make_shared_ptr(new PackageDepSpec(parse_user_package_dep_spec(s, e.get(), o, f)))));
+ 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);
}
@@ -1389,7 +1389,7 @@ paludis::ruby::value_to_dep_tree(VALUE v)
}
else if (rb_obj_is_kind_of(v, c_dep_spec))
{
- ValueToTree<H_> vtt(v, make_shared_ptr(new H_(make_shared_ptr(new AllDepSpec))));
+ ValueToTree<H_> vtt(v, std::make_shared<H_>(std::make_shared<AllDepSpec>()));
return vtt.result;
}
else