aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-11 02:48:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-11 02:48:23 +0000
commit5c15b4c20d57fb0f4e9d0742aae3d4e46f3b0954 (patch)
tree0cf22f64587c908e0c7d9bc4a296e6da8bcf96e9
parent15ecdaafeaa624b8f580240223d0c1282a990d25 (diff)
downloadpaludis-5c15b4c20d57fb0f4e9d0742aae3d4e46f3b0954.tar.gz
paludis-5c15b4c20d57fb0f4e9d0742aae3d4e46f3b0954.tar.xz
Nuke some unused code
-rw-r--r--paludis/match_package.hh8
-rw-r--r--paludis/repositories/portage/Makefile.am4
-rw-r--r--paludis/util/counted_ptr.cc28
-rw-r--r--paludis/util/counted_ptr.hh209
-rw-r--r--paludis/util/counted_ptr_TEST.cc17
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/stringify.hh6
-rw-r--r--src/adjutrix/Makefile.am2
8 files changed, 39 insertions, 237 deletions
diff --git a/paludis/match_package.hh b/paludis/match_package.hh
index a9cc620..5999ab9 100644
--- a/paludis/match_package.hh
+++ b/paludis/match_package.hh
@@ -64,8 +64,8 @@ namespace paludis
*
* \ingroup grpmatchpackage
*/
- template <typename P1_, typename P2_>
- inline const Environment * sanitise_env(const CountedPtr<const Environment, P1_, P2_> env)
+ template <typename P1_>
+ inline const Environment * sanitise_env(const CountedPtr<const Environment, P1_> env)
{
return env.raw_pointer();
}
@@ -95,8 +95,8 @@ namespace paludis
*
* \ingroup grpmatchpackage
*/
- template <typename P1_, typename P2_>
- inline const PackageDepAtom * sanitise_atom(const CountedPtr<const PackageDepAtom, P1_, P2_> atom)
+ template <typename P1_>
+ inline const PackageDepAtom * sanitise_atom(const CountedPtr<const PackageDepAtom, P1_> atom)
{
return atom.raw_pointer();
}
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index fa9a4d9..648169d 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -48,15 +48,17 @@ libpaludisportagerepository_la_SOURCES = \
$(paludis_repositories_portage_include_HEADERS)
libpaludisportagerepository_la_LIBADD = \
- $(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/libpaludis.la \
$(DYNAMIC_LD_LIBS)
portage_repository_TEST_SOURCES = portage_repository_TEST.cc
portage_repository_TEST_LDADD = \
libpaludisportagerepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/environment/test/libpaludistestenvironment.la \
$(top_builddir)/test/libtest.a
diff --git a/paludis/util/counted_ptr.cc b/paludis/util/counted_ptr.cc
deleted file mode 100644
index 0b2279d..0000000
--- a/paludis/util/counted_ptr.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/util/counted_ptr.hh>
-
-using namespace paludis;
-
-CountedPtrError::CountedPtrError() throw () :
- Exception("CountedPtr dereference error")
-{
-}
-
diff --git a/paludis/util/counted_ptr.hh b/paludis/util/counted_ptr.hh
index 6c3adc9..f00575d 100644
--- a/paludis/util/counted_ptr.hh
+++ b/paludis/util/counted_ptr.hh
@@ -33,24 +33,6 @@
namespace paludis
{
/**
- * Thrown when a CountedPtr check fails.
- *
- * \ingroup grppointers
- * \ingroup grpexceptions
- */
- class PALUDIS_VISIBLE CountedPtrError :
- public Exception
- {
- public:
- ///\name Basic operations
- ///\{
-
- CountedPtrError() throw ();
-
- ///\}
- };
-
- /**
* Contains CountedPtr count policies.
*
* \ingroup grppointers
@@ -78,33 +60,6 @@ namespace paludis
}
/**
- * Contains CountedPtr dereference policies.
- *
- * \ingroup grppointers
- */
- namespace dereference_policy
- {
- /**
- * CountedPtr dereferences are not checked.
- *
- * \ingroup grppointers
- */
- struct UncheckedDereferenceTag
- {
- };
-
- /**
- * CountedPtr dereferences are checked, and a CountedPtrError is
- * thrown for 0 dereferences.
- *
- * \ingroup grppointers
- */
- struct CheckedDereferenceTag
- {
- };
- }
-
- /**
* CountedPtr internals.
*
* \ingroup grppointers
@@ -116,110 +71,9 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename DereferencePolicy_>
- class CountedPtrBase;
-
- /**
- * Base class for CountedPtr (specialisation for UncheckedDereferenceTag).
- *
- * \ingroup grppointers
- */
- template <typename T_>
- class CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag> :
- public ComparisonPolicy<CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>,
- comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<T_ *> >
- {
- private:
- CountedPtrBase(const CountedPtrBase & other);
-
- const CountedPtrBase & operator= (const CountedPtrBase & other);
-
- protected:
- /**
- * Pointer to our data.
- */
- T_ * _ptr;
-
- ///\name Basic operations
- ///\{
-
- CountedPtrBase(T_ * ptr) :
- ComparisonPolicy<CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>,
- comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<T_ *> >(
- &CountedPtrBase::_ptr),
- _ptr(ptr)
- {
- }
-
- virtual ~CountedPtrBase()
- {
- }
-
- ///\}
-
- public:
- ///\name Dereference operators
- ///\{
-
- inline const T_ & operator* () const;
- inline const T_ * operator-> () const;
- T_ & operator* ();
- T_ * operator-> ();
-
- /**
- * Fetch our raw pointer.
- */
- T_ * raw_pointer() const
- {
- return _ptr;
- }
-
- ///\}
-
- /**
- * Return whether we are null. We use const void * rather than bool
- * here to avoid bool -> int conversion weirdness. See \ref
- * TCppPL 21.3.3.
- */
- operator const void * () const
- {
- return _ptr;
- }
- };
-
- template <typename T_>
- const T_ & CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>::operator* () const
- {
- return *_ptr;
- }
-
- template <typename T_>
- const T_ * CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>::operator-> () const
- {
- return _ptr;
- }
-
- template <typename T_>
- T_ & CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>::operator* ()
- {
- return *_ptr;
- }
-
- template <typename T_>
- T_ * CountedPtrBase<T_, dereference_policy::UncheckedDereferenceTag>::operator-> ()
- {
- return _ptr;
- }
- /**
- * Base class for CountedPtr (specialisation for CheckedDereferenceTag).
- *
- * \ingroup grppointers
- */
template <typename T_>
- class CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag> :
- public ComparisonPolicy<CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>,
+ class CountedPtrBase :
+ public ComparisonPolicy<CountedPtrBase<T_>,
comparison_mode::EqualityComparisonTag,
comparison_method::CompareByMemberTag<T_ *> >
{
@@ -238,7 +92,7 @@ namespace paludis
///\{
CountedPtrBase(T_ * ptr) :
- ComparisonPolicy<CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>,
+ ComparisonPolicy<CountedPtrBase<T_>,
comparison_mode::EqualityComparisonTag,
comparison_method::CompareByMemberTag<T_ *> >(
&CountedPtrBase::_ptr),
@@ -283,34 +137,26 @@ namespace paludis
};
template <typename T_>
- const T_ & CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>::operator* () const
+ const T_ & CountedPtrBase<T_>::operator* () const
{
- if (0 == _ptr)
- throw CountedPtrError();
return *_ptr;
}
template <typename T_>
- const T_ * CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>::operator-> () const
+ const T_ * CountedPtrBase<T_>::operator-> () const
{
- if (0 == _ptr)
- throw CountedPtrError();
return _ptr;
}
template <typename T_>
- T_ & CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>::operator* ()
+ T_ & CountedPtrBase<T_>::operator* ()
{
- if (0 == _ptr)
- throw CountedPtrError();
return *_ptr;
}
template <typename T_>
- T_ * CountedPtrBase<T_, dereference_policy::CheckedDereferenceTag>::operator-> ()
+ T_ * CountedPtrBase<T_>::operator-> ()
{
- if (0 == _ptr)
- throw CountedPtrError();
return _ptr;
}
}
@@ -320,8 +166,7 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename CountPolicy_ = count_policy::InternalCountTag,
- typename DereferencePolicy_ = dereference_policy::UncheckedDereferenceTag>
+ template <typename T_, typename CountPolicy_ = count_policy::InternalCountTag>
class CountedPtr;
/**
@@ -329,7 +174,7 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename DereferencePolicy_ = dereference_policy::UncheckedDereferenceTag>
+ template <typename T_>
class InternalCounted;
/**
@@ -337,9 +182,9 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename DereferencePolicy_>
- class CountedPtr<T_, count_policy::ExternalCountTag, DereferencePolicy_> :
- public counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>
+ template <typename T_>
+ class CountedPtr<T_, count_policy::ExternalCountTag> :
+ public counted_ptr_internals::CountedPtrBase<T_>
{
private:
unsigned * _ref_count;
@@ -349,13 +194,13 @@ namespace paludis
///\{
explicit CountedPtr(T_ * const ptr) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(ptr),
+ counted_ptr_internals::CountedPtrBase<T_>(ptr),
_ref_count(new unsigned(1))
{
}
CountedPtr(const CountedPtr & other) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(other.raw_pointer()),
+ counted_ptr_internals::CountedPtrBase<T_>(other.raw_pointer()),
_ref_count(other._ref_count)
{
++*_ref_count;
@@ -367,7 +212,7 @@ namespace paludis
*/
template <typename O_>
CountedPtr(const CountedPtr<O_, count_policy::ExternalCountTag> & other) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(other._ptr),
+ counted_ptr_internals::CountedPtrBase<T_>(other._ptr),
_ref_count(other.reference_count_pointer())
{
++*_ref_count;
@@ -439,23 +284,23 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename DereferencePolicy_>
- class CountedPtr<T_, count_policy::InternalCountTag, DereferencePolicy_> :
- public counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>
+ template <typename T_>
+ class CountedPtr<T_, count_policy::InternalCountTag> :
+ public counted_ptr_internals::CountedPtrBase<T_>
{
public:
///\name Basic operations
///\{
explicit CountedPtr(T_ * const ptr) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(ptr)
+ counted_ptr_internals::CountedPtrBase<T_>(ptr)
{
if (0 != this->_ptr)
++*this->_ptr->reference_count_pointer();
}
CountedPtr(const CountedPtr & other) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(other._ptr)
+ counted_ptr_internals::CountedPtrBase<T_>(other._ptr)
{
if (0 != this->_ptr)
++*this->_ptr->reference_count_pointer();
@@ -467,7 +312,7 @@ namespace paludis
*/
template <typename O_>
CountedPtr(const CountedPtr<O_, count_policy::InternalCountTag> & other) :
- counted_ptr_internals::CountedPtrBase<T_, DereferencePolicy_>(
+ counted_ptr_internals::CountedPtrBase<T_>(
static_cast<T_ *>(other.raw_pointer()))
{
if (0 != this->_ptr)
@@ -526,8 +371,8 @@ namespace paludis
///\}
};
- template <typename T_, typename DereferencePolicy_>
- CountedPtr<T_, count_policy::InternalCountTag, DereferencePolicy_>::~CountedPtr()
+ template <typename T_>
+ CountedPtr<T_, count_policy::InternalCountTag>::~CountedPtr()
{
if (0 != this->_ptr)
if (0 == --(*this->_ptr->reference_count_pointer()))
@@ -544,9 +389,9 @@ namespace paludis
*
* \ingroup grppointers
*/
- template <typename T_, typename DereferencePolicy_>
+ template <typename T_>
class InternalCounted :
- private InstantiationPolicy<InternalCounted<T_, DereferencePolicy_>,
+ private InstantiationPolicy<InternalCounted<T_>,
instantiation_method::NonCopyableTag>
{
private:
@@ -574,12 +419,12 @@ namespace paludis
/**
* A CountedPtr to us.
*/
- typedef CountedPtr<T_, count_policy::InternalCountTag, DereferencePolicy_> Pointer;
+ typedef CountedPtr<T_, count_policy::InternalCountTag> Pointer;
/**
* A CountedPtr to us (const).
*/
- typedef CountedPtr<const T_, count_policy::InternalCountTag, DereferencePolicy_> ConstPointer;
+ typedef CountedPtr<const T_, count_policy::InternalCountTag> ConstPointer;
///\}
diff --git a/paludis/util/counted_ptr_TEST.cc b/paludis/util/counted_ptr_TEST.cc
index 4db5b5d..5faaab7 100644
--- a/paludis/util/counted_ptr_TEST.cc
+++ b/paludis/util/counted_ptr_TEST.cc
@@ -369,22 +369,5 @@ namespace test_cases
TEST_CHECK(! i);
}
} test_counted_ptr_internal_assign_pointer;
-
- /**
- * \test CountedPtr zero dereferences.
- *
- * \ingroup grptestcases
- */
- struct CountedPtrZeroDeferenceTests : TestCase
- {
- CountedPtrZeroDeferenceTests() :
- TestCase("CountedPtr zero dereference tests") { }
-
- void run()
- {
- CountedPtr<int, count_policy::ExternalCountTag, dereference_policy::CheckedDereferenceTag> i(0);
- TEST_CHECK_THROWS(++*i, CountedPtrError);
- }
- } test_counted_ptr_zero_dereference;
}
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 47e50b2..e8ffdba 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -13,7 +13,7 @@ add(`collection', `hh')
add(`collection_concrete', `hhx')
add(`compare', `hh')
add(`comparison_policy', `hh')
-add(`counted_ptr', `hh', `cc', `test')
+add(`counted_ptr', `hh', `test')
add(`destringify', `hh', `cc', `test')
add(`dir_iterator', `hh', `cc', `test', `testscript')
add(`exception', `hh', `cc')
diff --git a/paludis/util/stringify.hh b/paludis/util/stringify.hh
index 0d69221..807a0ac 100644
--- a/paludis/util/stringify.hh
+++ b/paludis/util/stringify.hh
@@ -32,7 +32,7 @@
namespace paludis
{
- template <typename T_, typename U_, typename V_>
+ template <typename T_, typename U_>
class CountedPtr;
/**
@@ -71,8 +71,8 @@ namespace paludis
*
* \ingroup grpstringify
*/
- template <typename T_, typename U_, typename V_>
- struct CheckType<CountedPtr<T_, U_, V_> >
+ template <typename T_, typename U_>
+ struct CheckType<CountedPtr<T_, U_> >
{
};
diff --git a/src/adjutrix/Makefile.am b/src/adjutrix/Makefile.am
index 771631a..11eac6e 100644
--- a/src/adjutrix/Makefile.am
+++ b/src/adjutrix/Makefile.am
@@ -38,11 +38,11 @@ adjutrix_SOURCES = \
adjutrix.cc
adjutrix_LDADD = \
+ $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
$(top_builddir)/paludis/tasks/libpaludistasks.a \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
$(top_builddir)/paludis/environment/no_config/libpaludisnoconfigenvironment.la \
$(top_builddir)/src/libcolour.a \
$(DYNAMIC_LD_LIBS)