[paludis-commits] paludis.git (master) -- 162a593 by Ciaran McCreesh

git at git.pioto.org git at git.pioto.org
Fri Sep 19 03:16:07 EDT 2008


Module:    paludis.git
Branch:    master
Commit:    162a593a59467a7293228cd598f6a3c74a6e0ec4
URL:       http://git.pioto.org/?p=paludis.git;a=commit;h=162a593a59467a7293228cd598f6a3c74a6e0ec4

Author:    Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
Committer: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
Date:      Fri Sep 19 08:15:58 2008 +0100

----

Be consistent in how we handle sptrs

----

 paludis/contents.cc                                |    2 +-
 paludis/contents.hh                                |    2 +-
 paludis/dep_list.cc                                |   36 ++++++++++----------
 paludis/dep_list.hh                                |   36 ++++++++++----------
 paludis/dep_list_exceptions.cc                     |    2 +-
 paludis/dep_list_exceptions.hh                     |    2 +-
 paludis/dep_spec.cc                                |    2 +-
 paludis/dep_spec.hh                                |    2 +-
 paludis/environment.hh                             |    2 +-
 .../environments/adapted/adapted_environment.cc    |    6 ++--
 .../environments/adapted/adapted_environment.hh    |    6 ++--
 .../no_config/no_config_environment.cc             |    2 +-
 .../no_config/no_config_environment.hh             |    2 +-
 paludis/environments/paludis/keywords_conf.cc      |    2 +-
 paludis/environments/paludis/keywords_conf.hh      |    2 +-
 .../environments/paludis/paludis_environment.cc    |    2 +-
 .../environments/paludis/paludis_environment.hh    |    2 +-
 .../environments/portage/portage_environment.cc    |    2 +-
 .../environments/portage/portage_environment.hh    |    2 +-
 paludis/environments/test/test_environment.cc      |    2 +-
 paludis/environments/test/test_environment.hh      |    2 +-
 paludis/install_task.cc                            |    4 +-
 paludis/install_task.hh                            |    4 +-
 paludis/ndbam_unmerger.cc                          |    8 ++--
 paludis/ndbam_unmerger.hh                          |    8 ++--
 paludis/query_visitor.cc                           |    2 +-
 paludis/query_visitor.hh                           |    2 +-
 paludis/repositories/e/e_key.cc                    |    4 +-
 paludis/repositories/e/e_key.hh                    |    4 +-
 paludis/repositories/e/e_repository_entries.hh     |   12 +++---
 paludis/repositories/e/ebuild_entries.cc           |   12 +++---
 paludis/repositories/e/ebuild_entries.hh           |   12 +++---
 .../repositories/e/ebuild_flat_metadata_cache.cc   |    2 +-
 .../repositories/e/ebuild_flat_metadata_cache.hh   |    2 +-
 paludis/repositories/e/glsa.cc                     |    2 +-
 paludis/repositories/e/glsa.hh                     |    2 +-
 paludis/repositories/e/vdb_unmerger.cc             |    8 ++--
 paludis/repositories/e/vdb_unmerger.hh             |    8 ++--
 paludis/repositories/fake/fake_repository.cc       |    2 +-
 paludis/repositories/fake/fake_repository.hh       |    2 +-
 paludis/repositories/fake/fake_repository_base.cc  |    2 +-
 paludis/repositories/fake/fake_repository_base.hh  |    2 +-
 paludis/selinux/security_context.cc                |    4 +-
 paludis/selinux/security_context.hh                |    6 ++--
 paludis/show_suggest_visitor.cc                    |    2 +-
 paludis/show_suggest_visitor.hh                    |    2 +-
 paludis/stage_builder_task.cc                      |    2 +-
 paludis/stage_builder_task.hh                      |   12 +++---
 paludis/uninstall_list.cc                          |    6 ++--
 paludis/uninstall_list.hh                          |    6 ++--
 paludis/uninstall_task.cc                          |    2 +-
 paludis/uninstall_task.hh                          |    2 +-
 paludis/unmerger.cc                                |   18 +++++-----
 paludis/unmerger.hh                                |   26 +++++++-------
 paludis/util/graph.cc                              |    2 +-
 paludis/util/graph.hh                              |    2 +-
 paludis/util/visitor-impl.hh                       |   20 +++++-----
 paludis/util/visitor.hh                            |   20 +++++-----
 python/environment.cc                              |    2 +-
 src/clients/contrarius/install.cc                  |    2 +-
 src/clients/contrarius/install.hh                  |    2 +-
 src/clients/contrarius/stage.hh                    |   16 ++++----
 src/clients/contrarius/stage_builder.cc            |   10 +++---
 src/clients/contrarius/stage_builder.hh            |   10 +++---
 .../libgtkpaludis/categories_list_model.cc         |    2 +-
 .../libgtkpaludis/categories_list_model.hh         |    2 +-
 .../gtkpaludis/libgtkpaludis/package_buttons.cc    |    2 +-
 .../gtkpaludis/libgtkpaludis/package_buttons.hh    |    2 +-
 .../libgtkpaludis/packages_list_filtered_model.hh  |    2 +-
 .../libgtkpaludis/packages_list_model.cc           |    2 +-
 .../libgtkpaludis/packages_list_model.hh           |    2 +-
 .../gtkpaludis/libgtkpaludis/packages_page.cc      |    8 ++--
 .../gtkpaludis/libgtkpaludis/packages_page.hh      |    8 ++--
 .../packages_repository_filter_model.cc            |    2 +-
 .../packages_repository_filter_model.hh            |    2 +-
 .../libgtkpaludis/repositories_list_model.cc       |    2 +-
 .../libgtkpaludis/repositories_list_model.hh       |    2 +-
 .../gtkpaludis/libgtkpaludis/sets_list_model.cc    |    2 +-
 .../gtkpaludis/libgtkpaludis/sets_list_model.hh    |    2 +-
 .../gtkpaludis/libgtkpaludis/version_info_model.cc |    4 +-
 .../gtkpaludis/libgtkpaludis/version_info_model.hh |    4 +-
 .../libgtkpaludis/versions_list_model.cc           |    2 +-
 .../libgtkpaludis/versions_list_model.hh           |    2 +-
 .../gtkpaludis/libgtkpaludis/versions_page.cc      |    2 +-
 .../gtkpaludis/libgtkpaludis/versions_page.hh      |    2 +-
 src/clients/paludis/applets.cc                     |   14 ++++----
 src/clients/paludis/applets.hh                     |   14 ++++----
 src/clients/paludis/do_config.cc                   |    2 +-
 src/clients/paludis/do_config.hh                   |    2 +-
 src/clients/paludis/do_contents.cc                 |    2 +-
 src/clients/paludis/do_contents.hh                 |    2 +-
 src/clients/paludis/do_executables.cc              |    2 +-
 src/clients/paludis/do_executables.hh              |    2 +-
 src/clients/paludis/install.cc                     |    2 +-
 src/clients/paludis/install.hh                     |    2 +-
 src/clients/paludis/list.cc                        |    8 ++--
 src/clients/paludis/list.hh                        |    8 ++--
 src/clients/paludis/owner.cc                       |    2 +-
 src/clients/paludis/owner.hh                       |    2 +-
 src/clients/paludis/query.cc                       |    8 ++--
 src/clients/paludis/query.hh                       |    2 +-
 src/clients/paludis/report.cc                      |    2 +-
 src/clients/paludis/report.hh                      |    2 +-
 src/clients/paludis/sync.cc                        |    2 +-
 src/clients/paludis/sync.hh                        |    2 +-
 src/clients/paludis/uninstall.cc                   |    4 +-
 src/clients/paludis/uninstall.hh                   |    4 +-
 src/output/console_install_task.cc                 |   18 +++++-----
 src/output/console_install_task.hh                 |   18 +++++-----
 src/output/console_query_task.cc                   |   23 ++++++------
 src/output/console_query_task.hh                   |    6 ++--
 111 files changed, 305 insertions(+), 304 deletions(-)


diff --git a/paludis/contents.cc b/paludis/contents.cc
index 01f71af..4b250e7 100644
--- a/paludis/contents.cc
+++ b/paludis/contents.cc
@@ -119,7 +119,7 @@ Contents::~Contents()
 }
 
 void
-Contents::add(std::tr1::shared_ptr<const ContentsEntry> c)
+Contents::add(const std::tr1::shared_ptr<const ContentsEntry> & c)
 {
     _imp->c.push_back(c);
 }
diff --git a/paludis/contents.hh b/paludis/contents.hh
index f357698..f3c9562 100644
--- a/paludis/contents.hh
+++ b/paludis/contents.hh
@@ -244,7 +244,7 @@ namespace paludis
             ///\}
 
             /// Add a new entry.
-            void add(std::tr1::shared_ptr<const ContentsEntry> c);
+            void add(const std::tr1::shared_ptr<const ContentsEntry> & c);
 
             ///\name Iterate over our entries
             ///\{
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index 320eb97..ea8a764 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -1007,7 +1007,7 @@ DepList::clear()
 
 void
 DepList::add_in_role(const bool only_if_not_suggested_label, DependencySpecTree::ConstItem & spec, const std::string & role,
-        std::tr1::shared_ptr<const DestinationsSet> destinations)
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     Context context("When adding " + role + (only_if_not_suggested_label ? " unless under a suggested label" : "") + ":");
     add_not_top_level(only_if_not_suggested_label, spec, destinations,
@@ -1017,8 +1017,8 @@ DepList::add_in_role(const bool only_if_not_suggested_label, DependencySpecTree:
 
 void
 DepList::add_not_top_level(const bool only_if_not_suggested_label,
-        DependencySpecTree::ConstItem & spec, std::tr1::shared_ptr<const DestinationsSet> destinations,
-                           std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > conditions)
+        DependencySpecTree::ConstItem & spec, const std::tr1::shared_ptr<const DestinationsSet> & destinations,
+                           const std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > & conditions)
 {
     DepListTransaction transaction(_imp->merge_list, _imp->merge_list_index, _imp->merge_list_generation);
 
@@ -1028,7 +1028,7 @@ DepList::add_not_top_level(const bool only_if_not_suggested_label,
 }
 
 void
-DepList::add(SetSpecTree::ConstItem & spec, std::tr1::shared_ptr<const DestinationsSet> destinations)
+DepList::add(SetSpecTree::ConstItem & spec, const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     DepListTransaction transaction(_imp->merge_list, _imp->merge_list_index, _imp->merge_list_generation);
 
@@ -1041,16 +1041,16 @@ DepList::add(SetSpecTree::ConstItem & spec, std::tr1::shared_ptr<const Destinati
 }
 
 void
-DepList::add(const PackageDepSpec & spec, std::tr1::shared_ptr<const DestinationsSet> destinations)
+DepList::add(const PackageDepSpec & spec, const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     TreeLeaf<SetSpecTree, PackageDepSpec> l(std::tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(spec)));
     add(l, destinations);
 }
 
 void
-DepList::add_package(const std::tr1::shared_ptr<const PackageID> & p, std::tr1::shared_ptr<const DepTag> tag,
-        const PackageDepSpec & pds, std::tr1::shared_ptr<DependencySpecTree::ConstItem> conditions,
-        std::tr1::shared_ptr<const DestinationsSet> destinations)
+DepList::add_package(const std::tr1::shared_ptr<const PackageID> & p, const std::tr1::shared_ptr<const DepTag> & tag,
+        const PackageDepSpec & pds, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> & conditions,
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     Context context("When adding package '" + stringify(*p) + "':");
 
@@ -1187,7 +1187,7 @@ DepList::add_package(const std::tr1::shared_ptr<const PackageID> & p, std::tr1::
 
 void
 DepList::add_error_package(const std::tr1::shared_ptr<const PackageID> & p, const DepListEntryKind kind,
-        const PackageDepSpec & pds, std::tr1::shared_ptr<DependencySpecTree::ConstItem> conditions)
+        const PackageDepSpec & pds, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> & conditions)
 {
     std::pair<MergeListIndex::iterator, MergeListIndex::const_iterator> pp(
             _imp->merge_list_index.equal_range(p->name()));
@@ -1226,8 +1226,8 @@ DepList::add_error_package(const std::tr1::shared_ptr<const PackageID> & p, cons
 
 void
 DepList::add_suggested_package(const std::tr1::shared_ptr<const PackageID> & p,
-        const PackageDepSpec & pds, std::tr1::shared_ptr<DependencySpecTree::ConstItem> conditions,
-        const std::tr1::shared_ptr<const DestinationsSet> destinations)
+        const PackageDepSpec & pds, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> & conditions,
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     std::pair<MergeListIndex::iterator, MergeListIndex::const_iterator> pp(
             _imp->merge_list_index.equal_range(p->name()));
@@ -1262,7 +1262,7 @@ DepList::add_suggested_package(const std::tr1::shared_ptr<const PackageID> & p,
 
 void
 DepList::add_predeps(DependencySpecTree::ConstItem & d, const DepListDepsOption opt, const std::string & s,
-        std::tr1::shared_ptr<const DestinationsSet> destinations, const bool only_if_not_suggested_label)
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label)
 {
     if (dl_deps_pre == opt || dl_deps_pre_or_post == opt)
     {
@@ -1284,7 +1284,7 @@ DepList::add_predeps(DependencySpecTree::ConstItem & d, const DepListDepsOption
 
 void
 DepList::add_postdeps(DependencySpecTree::ConstItem & d, const DepListDepsOption opt, const std::string & s,
-        std::tr1::shared_ptr<const DestinationsSet> destinations, const bool only_if_not_suggested_label)
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label)
 {
     if (dl_deps_pre_or_post == opt || dl_deps_post == opt || dl_deps_try_post == opt)
     {
@@ -1316,9 +1316,9 @@ DepList::add_postdeps(DependencySpecTree::ConstItem & d, const DepListDepsOption
 }
 
 void
-DepList::add_already_installed_package(const std::tr1::shared_ptr<const PackageID> & p, std::tr1::shared_ptr<const DepTag> tag,
-        const PackageDepSpec & pds, std::tr1::shared_ptr<DependencySpecTree::ConstItem> conditions,
-        const std::tr1::shared_ptr<const DestinationsSet> destinations)
+DepList::add_already_installed_package(const std::tr1::shared_ptr<const PackageID> & p, const std::tr1::shared_ptr<const DepTag> & tag,
+        const PackageDepSpec & pds, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> & conditions,
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations)
 {
     Context context("When adding installed package '" + stringify(*p) + "':");
 
@@ -1498,7 +1498,7 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
 
 bool
 DepList::already_installed(const DependencySpecTree::ConstItem & spec,
-        std::tr1::shared_ptr<const DestinationsSet> destinations) const
+        const std::tr1::shared_ptr<const DestinationsSet> & destinations) const
 {
     QueryVisitor visitor(this, destinations, _imp->env, _imp->current_package_id());
     spec.accept(visitor);
@@ -1575,7 +1575,7 @@ DepList::has_errors() const
 
 std::tr1::shared_ptr<Repository>
 DepList::find_destination(const PackageID & p,
-        std::tr1::shared_ptr<const DestinationsSet> dd)
+        const std::tr1::shared_ptr<const DestinationsSet> & dd)
 {
     for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ;
              d != d_end ; ++d)
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 4420fa1..9add976 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -74,13 +74,13 @@ namespace paludis
              * Find an appropriate destination for a package.
              */
             std::tr1::shared_ptr<Repository> find_destination(const PackageID &,
-                    std::tr1::shared_ptr<const DestinationsSet>);
+                    const std::tr1::shared_ptr<const DestinationsSet> &);
 
             /**
              * Add a DepSpec with role context.
              */
             void add_in_role(const bool only_if_not_suggested_label, DependencySpecTree::ConstItem &, const std::string & role,
-                    std::tr1::shared_ptr<const DestinationsSet>);
+                    const std::tr1::shared_ptr<const DestinationsSet> &);
 
             /**
              * Return whether we prefer the first parameter, which is installed,
@@ -92,34 +92,34 @@ namespace paludis
             /**
              * Add a package to the list.
              */
-            void add_package(const std::tr1::shared_ptr<const PackageID> &, std::tr1::shared_ptr<const DepTag>,
-                    const PackageDepSpec &, std::tr1::shared_ptr<DependencySpecTree::ConstItem>,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations);
+            void add_package(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const DepTag> &,
+                    const PackageDepSpec &, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> &,
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations);
 
             /**
              * Add an already installed package to the list.
              */
-            void add_already_installed_package(const std::tr1::shared_ptr<const PackageID> &, std::tr1::shared_ptr<const DepTag>,
-                    const PackageDepSpec &, std::tr1::shared_ptr<DependencySpecTree::ConstItem>,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations);
+            void add_already_installed_package(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const DepTag> &,
+                    const PackageDepSpec &, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> &,
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations);
 
             /**
              * Add an error package to the list.
              */
             void add_error_package(const std::tr1::shared_ptr<const PackageID> &, const DepListEntryKind,
-                    const PackageDepSpec &, std::tr1::shared_ptr<DependencySpecTree::ConstItem>);
+                    const PackageDepSpec &, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> &);
 
             /**
              * Add predependencies.
              */
             void add_predeps(DependencySpecTree::ConstItem &, const DepListDepsOption, const std::string &,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations, const bool only_if_not_suggested_label);
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label);
 
             /**
              * Add postdependencies.
              */
             void add_postdeps(DependencySpecTree::ConstItem &, const DepListDepsOption, const std::string &,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations, const bool only_if_not_suggested_label);
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations, const bool only_if_not_suggested_label);
 
             /**
              * Return whether the specified PackageID is matched by
@@ -130,8 +130,8 @@ namespace paludis
             void add_not_top_level(
                     const bool only_if_not_suggested_label,
                     DependencySpecTree::ConstItem &,
-                    std::tr1::shared_ptr<const DestinationsSet> target_destinations,
-                    std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > conditions);
+                    const std::tr1::shared_ptr<const DestinationsSet> & target_destinations,
+                    const std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > & conditions);
 
         public:
             ///\name Basic operations
@@ -175,14 +175,14 @@ namespace paludis
              * spec.
              */
             void add(SetSpecTree::ConstItem &,
-                    std::tr1::shared_ptr<const DestinationsSet> target_destinations);
+                    const std::tr1::shared_ptr<const DestinationsSet> & target_destinations);
 
             /**
              * Add the packages required to resolve an additional dependency
              * spec.
              */
             void add(const PackageDepSpec &,
-                    std::tr1::shared_ptr<const DestinationsSet> target_destinations);
+                    const std::tr1::shared_ptr<const DestinationsSet> & target_destinations);
 
             /**
              * Manually add a DepListEntry to the list.
@@ -202,7 +202,7 @@ namespace paludis
              * Return whether a spec structure is already installed.
              */
             bool already_installed(DependencySpecTree::ConstItem &,
-                    std::tr1::shared_ptr<const DestinationsSet> target_destinations) const;
+                    const std::tr1::shared_ptr<const DestinationsSet> & target_destinations) const;
 
             /**
              * Return whether a PackageID has been replaced.
@@ -223,8 +223,8 @@ namespace paludis
              * Add a suggested package to the list.
              */
             void add_suggested_package(const std::tr1::shared_ptr<const PackageID> &,
-                    const PackageDepSpec &, std::tr1::shared_ptr<DependencySpecTree::ConstItem>,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations);
+                    const PackageDepSpec &, const std::tr1::shared_ptr<DependencySpecTree::ConstItem> &,
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations);
     };
 
 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
diff --git a/paludis/dep_list_exceptions.cc b/paludis/dep_list_exceptions.cc
index eff49cc..44b934d 100644
--- a/paludis/dep_list_exceptions.cc
+++ b/paludis/dep_list_exceptions.cc
@@ -84,7 +84,7 @@ namespace
 }
 
 NoDestinationError::NoDestinationError(const PackageID & p,
-        std::tr1::shared_ptr<const DestinationsSet> d) throw () :
+        const std::tr1::shared_ptr<const DestinationsSet> & d) throw () :
     DepListError("No suitable destination for '" + stringify(p) + "' in (" +
             destinations_to_string(d) + ")")
 {
diff --git a/paludis/dep_list_exceptions.hh b/paludis/dep_list_exceptions.hh
index 1cab520..a8a3abd 100644
--- a/paludis/dep_list_exceptions.hh
+++ b/paludis/dep_list_exceptions.hh
@@ -189,7 +189,7 @@ namespace paludis
             ///\{
 
             NoDestinationError(const PackageID &,
-                    std::tr1::shared_ptr<const DestinationsSet>) throw ();
+                    const std::tr1::shared_ptr<const DestinationsSet> &) throw ();
 
             ///\}
     };
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index 535d217..7d6f872 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -273,7 +273,7 @@ PackageDepSpec::as_package_dep_spec() const
     return this;
 }
 
-BlockDepSpec::BlockDepSpec(std::tr1::shared_ptr<const PackageDepSpec> a) :
+BlockDepSpec::BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & a) :
     StringDepSpec("!" + a->text()),
     _spec(a)
 {
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index b9475c5..0b5cb82 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -781,7 +781,7 @@ namespace paludis
             ///\name Basic operations
             ///\{
 
-            BlockDepSpec(std::tr1::shared_ptr<const PackageDepSpec> spec);
+            BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec);
             BlockDepSpec(const std::tr1::shared_ptr<const PackageDepSpec> & spec, const std::string & text);
 
             ///\}
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 630c0b2..cc68aad 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -122,7 +122,7 @@ namespace paludis
              * Used by PackageID implementations. Generally PackageID's masks methods
              * should be used rather than calling this directly.
              */
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
 
             /**
diff --git a/paludis/environments/adapted/adapted_environment.cc b/paludis/environments/adapted/adapted_environment.cc
index 0ab410b..39af01e 100644
--- a/paludis/environments/adapted/adapted_environment.cc
+++ b/paludis/environments/adapted/adapted_environment.cc
@@ -49,7 +49,7 @@ namespace paludis
     };
 }
 
-AdaptedEnvironment::AdaptedEnvironment(std::tr1::shared_ptr<Environment> e) :
+AdaptedEnvironment::AdaptedEnvironment(const std::tr1::shared_ptr<Environment> & e) :
     PrivateImplementationPattern<AdaptedEnvironment>(new Implementation<AdaptedEnvironment>(e)),
     _imp(PrivateImplementationPattern<AdaptedEnvironment>::_imp)
 {
@@ -60,7 +60,7 @@ AdaptedEnvironment::~AdaptedEnvironment()
 }
 
 void
-AdaptedEnvironment::adapt_use(std::tr1::shared_ptr<const PackageDepSpec> p,
+AdaptedEnvironment::adapt_use(const std::tr1::shared_ptr<const PackageDepSpec> & p,
         const UseFlagName & u, const UseFlagState s)
 {
     _imp->use.insert(std::make_pair(u, std::make_pair(p, s)));
@@ -124,7 +124,7 @@ AdaptedEnvironment::accept_license(const std::string & l, const PackageID & e) c
 }
 
 bool
-AdaptedEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet> k, const PackageID & e) const
+AdaptedEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k, const PackageID & e) const
 {
     return _imp->env->accept_keywords(k, e);
 }
diff --git a/paludis/environments/adapted/adapted_environment.hh b/paludis/environments/adapted/adapted_environment.hh
index eddab4c..163576d 100644
--- a/paludis/environments/adapted/adapted_environment.hh
+++ b/paludis/environments/adapted/adapted_environment.hh
@@ -47,7 +47,7 @@ namespace paludis
             virtual void need_keys_added() const;
 
         public:
-            AdaptedEnvironment(std::tr1::shared_ptr<Environment>);
+            AdaptedEnvironment(const std::tr1::shared_ptr<Environment> &);
             ~AdaptedEnvironment();
 
             ///\name Adapting methods
@@ -56,7 +56,7 @@ namespace paludis
             /**
              * Set the state of a USE flag for the given PackageDepSpec.
              */
-            void adapt_use(std::tr1::shared_ptr<const PackageDepSpec>, const UseFlagName &, const UseFlagState);
+            void adapt_use(const std::tr1::shared_ptr<const PackageDepSpec> &, const UseFlagName &, const UseFlagState);
 
             /**
              * Clear all adaptions from this Environemnt.
@@ -78,7 +78,7 @@ namespace paludis
             virtual bool accept_license(const std::string &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
             virtual std::tr1::shared_ptr<PackageDatabase> package_database()
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 0bfa89f..b3f2b05 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -346,7 +346,7 @@ NoConfigEnvironment::set_paludis_command(const std::string & s)
 }
 
 bool
-NoConfigEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet> keywords,
+NoConfigEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & keywords,
         const PackageID &) const
 {
     if (_imp->is_vdb)
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index dcfe4cc..2c7d989 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -125,7 +125,7 @@ namespace paludis
             virtual bool accept_license(const std::string &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
diff --git a/paludis/environments/paludis/keywords_conf.cc b/paludis/environments/paludis/keywords_conf.cc
index 385d25a..c9ffb35 100644
--- a/paludis/environments/paludis/keywords_conf.cc
+++ b/paludis/environments/paludis/keywords_conf.cc
@@ -138,7 +138,7 @@ KeywordsConf::add(const FSEntry & filename)
 }
 
 bool
-KeywordsConf::query(std::tr1::shared_ptr<const KeywordNameSet> k, const PackageID & e) const
+KeywordsConf::query(const std::tr1::shared_ptr<const KeywordNameSet> & k, const PackageID & e) const
 {
     static const KeywordName star_keyword("*");
     static const KeywordName minus_star_keyword("-*");
diff --git a/paludis/environments/paludis/keywords_conf.hh b/paludis/environments/paludis/keywords_conf.hh
index e5c6e4c..c15f00c 100644
--- a/paludis/environments/paludis/keywords_conf.hh
+++ b/paludis/environments/paludis/keywords_conf.hh
@@ -59,7 +59,7 @@ namespace paludis
                 /**
                  * Query a collection of keywords.
                  */
-                bool query(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const;
+                bool query(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const;
         };
     }
 }
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 8829270..fc9a222 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -222,7 +222,7 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
 }
 
 bool
-PaludisEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet> k,
+PaludisEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k,
         const PackageID & e) const
 {
     return _imp->config->keywords_conf()->query(k, e);
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index ab89300..c6579bd 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -131,7 +131,7 @@ namespace paludis
             virtual std::string distribution() const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
             virtual bool accept_license(const std::string &, const PackageID &) const
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index f440341..961f9bd 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -617,7 +617,7 @@ PortageEnvironment::set_paludis_command(const std::string & s)
 }
 
 bool
-PortageEnvironment::accept_keywords(std::tr1::shared_ptr <const KeywordNameSet> keywords,
+PortageEnvironment::accept_keywords(const std::tr1::shared_ptr <const KeywordNameSet> & keywords,
         const PackageID & d) const
 {
     bool result(false);
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index a495602..52bbb60 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -133,7 +133,7 @@ namespace paludis
             virtual bool accept_license(const std::string &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 9c6565a..03440d8 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -84,7 +84,7 @@ TestEnvironment::query_use(const UseFlagName & u, const PackageID & p) const
 }
 
 bool
-TestEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet> k, const PackageID &) const
+TestEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k, const PackageID &) const
 {
     return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
 }
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 08d5754..5d25636 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -93,7 +93,7 @@ namespace paludis
             virtual bool accept_license(const std::string &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
-            virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>, const PackageID &) const
+            virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> &, const PackageID &) const
                 PALUDIS_ATTRIBUTE((warn_unused_result));
 
             virtual const std::tr1::shared_ptr<const Mask> mask_for_breakage(const PackageID &) const
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 7ce6205..97ec3e5 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -129,7 +129,7 @@ namespace paludis
 }
 
 InstallTask::InstallTask(Environment * const env, const DepListOptions & options,
-        const std::tr1::shared_ptr<const DestinationsSet> d) :
+        const std::tr1::shared_ptr<const DestinationsSet> & d) :
     PrivateImplementationPattern<InstallTask>(new Implementation<InstallTask>(env, options, d))
 {
 }
@@ -1260,7 +1260,7 @@ namespace
 }
 
 void
-InstallTask::world_update_packages(std::tr1::shared_ptr<const SetSpecTree::ConstItem> a)
+InstallTask::world_update_packages(const std::tr1::shared_ptr<const SetSpecTree::ConstItem> & a)
 {
     WorldTargetFinder w(_imp->env, this);
     a->accept(w);
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 286d0c7..3c1fe1e 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -76,7 +76,7 @@ namespace paludis
             ///\{
 
             InstallTask(Environment * const env, const DepListOptions & options,
-                    std::tr1::shared_ptr<const DestinationsSet> destinations);
+                    const std::tr1::shared_ptr<const DestinationsSet> & destinations);
 
             ///\}
 
@@ -209,7 +209,7 @@ namespace paludis
             ///\{
 
             virtual void world_update_set(const SetName &);
-            virtual void world_update_packages(std::tr1::shared_ptr<const SetSpecTree::ConstItem>);
+            virtual void world_update_packages(const std::tr1::shared_ptr<const SetSpecTree::ConstItem> &);
 
             ///\}
 
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index 29d7e9d..3786b1e 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -214,7 +214,7 @@ NDBAMUnmerger::populate_unmerge_set()
 }
 
 bool
-NDBAMUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+NDBAMUnmerger::check_file(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
 
@@ -243,7 +243,7 @@ NDBAMUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei)
 }
 
 bool
-NDBAMUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+NDBAMUnmerger::check_sym(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
 
@@ -260,13 +260,13 @@ NDBAMUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei)
 }
 
 bool
-NDBAMUnmerger::check_misc(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const
+NDBAMUnmerger::check_misc(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     return false;
 }
 
 bool
-NDBAMUnmerger::check_dir(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+NDBAMUnmerger::check_dir(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (! (_imp->options.root() / f).is_directory())
         display("--- [!type] " + stringify(f));
diff --git a/paludis/ndbam_unmerger.hh b/paludis/ndbam_unmerger.hh
index 21bece4..a3366bc 100644
--- a/paludis/ndbam_unmerger.hh
+++ b/paludis/ndbam_unmerger.hh
@@ -87,10 +87,10 @@ namespace paludis
 
             void display(const std::string &) const;
 
-            bool check_file(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_dir(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_sym(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_misc(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
+            bool check_file(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_dir(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_sym(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_misc(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
 
         public:
             ///\name Basic operations
diff --git a/paludis/query_visitor.cc b/paludis/query_visitor.cc
index c22fa3d..dd7560d 100644
--- a/paludis/query_visitor.cc
+++ b/paludis/query_visitor.cc
@@ -59,7 +59,7 @@ namespace paludis
     };
 }
 
-QueryVisitor::QueryVisitor(const DepList * const d, std::tr1::shared_ptr<const DestinationsSet> dd,
+QueryVisitor::QueryVisitor(const DepList * const d, const std::tr1::shared_ptr<const DestinationsSet> & dd,
         const Environment * const e, const std::tr1::shared_ptr<const PackageID> & id) :
     PrivateImplementationPattern<QueryVisitor>(new Implementation<QueryVisitor>(d, dd, e, id))
 {
diff --git a/paludis/query_visitor.hh b/paludis/query_visitor.hh
index c77c545..43d627e 100644
--- a/paludis/query_visitor.hh
+++ b/paludis/query_visitor.hh
@@ -50,7 +50,7 @@ namespace paludis
             ///\name Basic operations
             ///\{
 
-            QueryVisitor(const DepList * const, std::tr1::shared_ptr<const DestinationsSet>,
+            QueryVisitor(const DepList * const, const std::tr1::shared_ptr<const DestinationsSet> &,
                     const Environment * const, const std::tr1::shared_ptr<const PackageID> &);
 
             ~QueryVisitor();
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index c49300a..e6ec636 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -52,7 +52,7 @@ using namespace paludis;
 using namespace paludis::erepository;
 
 EMutableRepositoryMaskInfoKey::EMutableRepositoryMaskInfoKey(const std::tr1::shared_ptr<const ERepositoryID> &,
-        const std::string & r, const std::string & h, std::tr1::shared_ptr<const RepositoryMaskInfo> v, const MetadataKeyType t) :
+        const std::string & r, const std::string & h, const std::tr1::shared_ptr<const RepositoryMaskInfo> & v, const MetadataKeyType t) :
     MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > (r, h, t),
     _value(v)
 {
@@ -69,7 +69,7 @@ EMutableRepositoryMaskInfoKey::value() const
 }
 
 void
-EMutableRepositoryMaskInfoKey::set_value(std::tr1::shared_ptr<const RepositoryMaskInfo> v)
+EMutableRepositoryMaskInfoKey::set_value(const std::tr1::shared_ptr<const RepositoryMaskInfo> & v)
 {
     _value = v;
 }
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 8baae3e..5c3738a 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -38,13 +38,13 @@ namespace paludis
 
             public:
                 EMutableRepositoryMaskInfoKey(const std::tr1::shared_ptr<const ERepositoryID> &,
-                        const std::string &, const std::string &, std::tr1::shared_ptr<const RepositoryMaskInfo>, const MetadataKeyType);
+                        const std::string &, const std::string &, const std::tr1::shared_ptr<const RepositoryMaskInfo> &, const MetadataKeyType);
                 ~EMutableRepositoryMaskInfoKey();
 
                 virtual const std::tr1::shared_ptr<const RepositoryMaskInfo> value() const
                     PALUDIS_ATTRIBUTE((warn_unused_result));
 
-                void set_value(std::tr1::shared_ptr<const RepositoryMaskInfo>);
+                void set_value(const std::tr1::shared_ptr<const RepositoryMaskInfo> &);
         };
 
         class EDependenciesKey :
diff --git a/paludis/repositories/e/e_repository_entries.hh b/paludis/repositories/e/e_repository_entries.hh
index eea36e9..612c74d 100644
--- a/paludis/repositories/e/e_repository_entries.hh
+++ b/paludis/repositories/e/e_repository_entries.hh
@@ -77,37 +77,37 @@ namespace paludis
                  * Fetch an environment variable.
                  */
                 virtual std::string get_environment_variable(const std::tr1::shared_ptr<const ERepositoryID> &, const std::string & var,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
 
                 /**
                  * Handle an install.
                  */
                 virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &, const InstallActionOptions &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
 
                 /**
                  * Handle a fetch.
                  */
                 virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
 
                 /**
                  * Handle a pretend fetch.
                  */
                 virtual void pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> &, PretendFetchAction &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
 
                 /**
                  * Handle a pretend.
                  */
                 virtual bool pretend(const std::tr1::shared_ptr<const ERepositoryID> &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
 
                 /**
                  * Handle an info.
                  */
                 virtual void info(const std::tr1::shared_ptr<const ERepositoryID> &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const = 0;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
 
                 /**
                  * Handle a merge.
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 149f042..0f5b427 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -355,7 +355,7 @@ namespace
 
 void
 EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        const FetchActionOptions & o, std::tr1::shared_ptr<const ERepositoryProfile> p) const
+        const FetchActionOptions & o, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
 {
     using namespace std::tr1::placeholders;
 
@@ -506,7 +506,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
 
 void
 EbuildEntries::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        PretendFetchAction & a, std::tr1::shared_ptr<const ERepositoryProfile>) const
+        PretendFetchAction & a, const std::tr1::shared_ptr<const ERepositoryProfile> &) const
 {
     using namespace std::tr1::placeholders;
 
@@ -523,7 +523,7 @@ EbuildEntries::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & i
 
 void
 EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        const InstallActionOptions & o, std::tr1::shared_ptr<const ERepositoryProfile> p) const
+        const InstallActionOptions & o, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
 {
     using namespace std::tr1::placeholders;
 
@@ -738,7 +738,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
 
 void
 EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        std::tr1::shared_ptr<const ERepositoryProfile> p) const
+        const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
 {
     using namespace std::tr1::placeholders;
 
@@ -815,7 +815,7 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
 
 std::string
 EbuildEntries::get_environment_variable(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        const std::string & var, std::tr1::shared_ptr<const ERepositoryProfile>) const
+        const std::string & var, const std::tr1::shared_ptr<const ERepositoryProfile> &) const
 {
     EAPIPhases phases(id->eapi()->supported()->ebuild_phases()->ebuild_variable());
 
@@ -936,7 +936,7 @@ EbuildEntries::extract_package_file_version(const QualifiedPackageName & n, cons
 
 bool
 EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
-        std::tr1::shared_ptr<const ERepositoryProfile> p) const
+        const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
 {
     using namespace std::tr1::placeholders;
 
diff --git a/paludis/repositories/e/ebuild_entries.hh b/paludis/repositories/e/ebuild_entries.hh
index 41cf4b8..f1c6e86 100644
--- a/paludis/repositories/e/ebuild_entries.hh
+++ b/paludis/repositories/e/ebuild_entries.hh
@@ -79,22 +79,22 @@ namespace paludis
                     PALUDIS_ATTRIBUTE((warn_unused_result));
 
                 virtual std::string get_environment_variable(const std::tr1::shared_ptr<const ERepositoryID> &, const std::string & var,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual void pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> &, PretendFetchAction &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &, const InstallActionOptions &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual bool pretend(const std::tr1::shared_ptr<const ERepositoryID> &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual void info(const std::tr1::shared_ptr<const ERepositoryID> &,
-                        std::tr1::shared_ptr<const ERepositoryProfile>) const;
+                        const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
 
                 virtual std::string get_package_file_manifest_key(const FSEntry &, const QualifiedPackageName &) const;
 
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index b17ae35..225d667 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -268,7 +268,7 @@ namespace
 }
 
 EbuildFlatMetadataCache::EbuildFlatMetadataCache(const Environment * const v, FSEntry & f,
-        const FSEntry & e, std::time_t t, std::tr1::shared_ptr<const EclassMtimes> m, bool s) :
+        const FSEntry & e, std::time_t t, const std::tr1::shared_ptr<const EclassMtimes> & m, bool s) :
     PrivateImplementationPattern<EbuildFlatMetadataCache>(new Implementation<EbuildFlatMetadataCache>(v, f, e, t, m, s))
 {
 }
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.hh b/paludis/repositories/e/ebuild_flat_metadata_cache.hh
index 12a98cb..629cb59 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.hh
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.hh
@@ -47,7 +47,7 @@ namespace paludis
                 ///\{
 
                 EbuildFlatMetadataCache(const Environment * const, FSEntry & filename, const FSEntry & ebuild,
-                        time_t master_mtime, std::tr1::shared_ptr<const EclassMtimes> eclass_mtimes, bool silent);
+                        time_t master_mtime, const std::tr1::shared_ptr<const EclassMtimes> & eclass_mtimes, bool silent);
                 ~EbuildFlatMetadataCache();
 
                 ///\}
diff --git a/paludis/repositories/e/glsa.cc b/paludis/repositories/e/glsa.cc
index 4b0774b..7327eea 100644
--- a/paludis/repositories/e/glsa.cc
+++ b/paludis/repositories/e/glsa.cc
@@ -159,7 +159,7 @@ GLSA::end_packages() const
 }
 
 void
-GLSA::add_package(std::tr1::shared_ptr<const GLSAPackage> p)
+GLSA::add_package(const std::tr1::shared_ptr<const GLSAPackage> & p)
 {
     _imp->packages.push_back(p);
 }
diff --git a/paludis/repositories/e/glsa.hh b/paludis/repositories/e/glsa.hh
index 644aeb5..5a58f49 100644
--- a/paludis/repositories/e/glsa.hh
+++ b/paludis/repositories/e/glsa.hh
@@ -150,7 +150,7 @@ namespace paludis
             /**
              * Add a package.
              */
-            void add_package(std::tr1::shared_ptr<const GLSAPackage>);
+            void add_package(const std::tr1::shared_ptr<const GLSAPackage> &);
 
             /**
              * Set our ID.
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index af1e3b0..21d3fe5 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -251,7 +251,7 @@ VDBUnmerger::populate_unmerge_set()
 }
 
 bool
-VDBUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+VDBUnmerger::check_file(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
 
@@ -280,7 +280,7 @@ VDBUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
 }
 
 bool
-VDBUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+VDBUnmerger::check_sym(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
 
@@ -297,7 +297,7 @@ VDBUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) co
 }
 
 bool
-VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+VDBUnmerger::check_misc(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     std::tr1::shared_ptr<MiscExtraInfo> mie(std::tr1::static_pointer_cast<MiscExtraInfo>(ei));
 
@@ -312,7 +312,7 @@ VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
 }
 
 bool
-VDBUnmerger::check_dir(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+VDBUnmerger::check_dir(const FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (! (_imp->options.root() / f).is_directory())
         display("--- [!type] " + stringify(f));
diff --git a/paludis/repositories/e/vdb_unmerger.hh b/paludis/repositories/e/vdb_unmerger.hh
index 5d2b262..e02c6f3 100644
--- a/paludis/repositories/e/vdb_unmerger.hh
+++ b/paludis/repositories/e/vdb_unmerger.hh
@@ -100,10 +100,10 @@ namespace paludis
 
             void display(const std::string &) const;
 
-            bool check_file(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_dir(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_sym(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            bool check_misc(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
+            bool check_file(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_dir(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_sym(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            bool check_misc(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
 
         public:
             ///\name Basic operations
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 65779f8..fcd9f4c 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -115,7 +115,7 @@ FakeRepository::virtual_packages() const
 }
 
 void
-FakeRepository::add_virtual_package(const QualifiedPackageName & q, std::tr1::shared_ptr<const PackageDepSpec> p)
+FakeRepository::add_virtual_package(const QualifiedPackageName & q, const std::tr1::shared_ptr<const PackageDepSpec> & p)
 {
     _imp->virtual_packages->push_back(make_named_values<RepositoryVirtualsEntry>(
                 value_for<n::provided_by_spec>(p),
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index 0ad564c..a4384c6 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -56,7 +56,7 @@ namespace paludis
             /**
              * Add a virtual package.
              */
-            void add_virtual_package(const QualifiedPackageName &, std::tr1::shared_ptr<const PackageDepSpec>);
+            void add_virtual_package(const QualifiedPackageName &, const std::tr1::shared_ptr<const PackageDepSpec> &);
 
             /* RepositoryVirtualsInterface */
 
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 7f28754..a87cc3b 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -208,7 +208,7 @@ FakeRepositoryBase::use_expand_separator(const PackageID & id) const
 }
 
 void
-FakeRepositoryBase::add_package_set(const SetName & n, std::tr1::shared_ptr<SetSpecTree::ConstItem> s)
+FakeRepositoryBase::add_package_set(const SetName & n, const std::tr1::shared_ptr<SetSpecTree::ConstItem> & s)
 {
     _imp->sets.insert(std::make_pair(n, s));
 }
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index 4a49e4a..8522665 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -96,7 +96,7 @@ namespace paludis
             /**
              * Add a package set.
              */
-            void add_package_set(const SetName &, std::tr1::shared_ptr<SetSpecTree::ConstItem>);
+            void add_package_set(const SetName &, const std::tr1::shared_ptr<SetSpecTree::ConstItem> &);
 
             virtual void invalidate();
 
diff --git a/paludis/selinux/security_context.cc b/paludis/selinux/security_context.cc
index 7b0f619..c79c09e 100644
--- a/paludis/selinux/security_context.cc
+++ b/paludis/selinux/security_context.cc
@@ -206,7 +206,7 @@ std::ostream & paludis::operator<<(std::ostream & os, const SecurityContext & co
     return os;
 }
 
-FSCreateCon::FSCreateCon(std::tr1::shared_ptr<const SecurityContext> newfscreatecon)
+FSCreateCon::FSCreateCon(const std::tr1::shared_ptr<const SecurityContext> & newfscreatecon)
     : _context(newfscreatecon), _prev_context(SecurityContext::fs_create_context())
 {
     if (0 != libselinux.setfscreatecon(_context->_imp->_context))
@@ -256,7 +256,7 @@ std::tr1::shared_ptr<const SecurityContext> MatchPathCon::match(const std::strin
     return p;
 }
 
-int paludis::setfilecon(const paludis::FSEntry & path, std::tr1::shared_ptr<const SecurityContext> con)
+int paludis::setfilecon(const paludis::FSEntry & path, const std::tr1::shared_ptr<const SecurityContext> & con)
 {
     return libselinux.setfilecon(stringify(path).c_str(), con->_imp->_context);
 }
diff --git a/paludis/selinux/security_context.hh b/paludis/selinux/security_context.hh
index bd507ff..b9e5eb8 100644
--- a/paludis/selinux/security_context.hh
+++ b/paludis/selinux/security_context.hh
@@ -82,7 +82,7 @@ namespace paludis
             friend std::ostream& paludis::operator<<(std::ostream&, const SecurityContext &);
             friend class paludis::FSCreateCon;
             friend class paludis::MatchPathCon;
-            friend int paludis::setfilecon(const paludis::FSEntry &, std::tr1::shared_ptr<const SecurityContext>);
+            friend int paludis::setfilecon(const paludis::FSEntry &, const std::tr1::shared_ptr<const SecurityContext> &);
 
             /**
              * Returns a SecurityContext referring to the current process's context
@@ -124,7 +124,7 @@ namespace paludis
             /**
              * Constructor
              */
-            FSCreateCon(std::tr1::shared_ptr<const SecurityContext>);
+            FSCreateCon(const std::tr1::shared_ptr<const SecurityContext> &);
 
             /**
              * Destructor
@@ -170,7 +170,7 @@ namespace paludis
      *
      * \ingroup grplibpaludisselinux
      */
-    int setfilecon(const FSEntry & file, std::tr1::shared_ptr<const SecurityContext> con) PALUDIS_VISIBLE;
+    int setfilecon(const FSEntry & file, const std::tr1::shared_ptr<const SecurityContext> & con) PALUDIS_VISIBLE;
 
     /**
      * Whether SELinux is enabled. Ideally, you are not using this function.
diff --git a/paludis/show_suggest_visitor.cc b/paludis/show_suggest_visitor.cc
index 4252a08..b626b83 100644
--- a/paludis/show_suggest_visitor.cc
+++ b/paludis/show_suggest_visitor.cc
@@ -75,7 +75,7 @@ namespace paludis
     };
 }
 
-ShowSuggestVisitor::ShowSuggestVisitor(DepList * const d, std::tr1::shared_ptr<const DestinationsSet> dd,
+ShowSuggestVisitor::ShowSuggestVisitor(DepList * const d, const std::tr1::shared_ptr<const DestinationsSet> & dd,
         const Environment * const e, const std::tr1::shared_ptr<const PackageID> & p, bool t, bool l) :
     PrivateImplementationPattern<ShowSuggestVisitor>(new Implementation<ShowSuggestVisitor>(d, dd, e, p, t, l))
 {
diff --git a/paludis/show_suggest_visitor.hh b/paludis/show_suggest_visitor.hh
index dc568de..e668571 100644
--- a/paludis/show_suggest_visitor.hh
+++ b/paludis/show_suggest_visitor.hh
@@ -50,7 +50,7 @@ namespace paludis
             ///\name Basic operations
             ///\{
 
-            ShowSuggestVisitor(DepList * const dd, std::tr1::shared_ptr<const DestinationsSet> ddd,
+            ShowSuggestVisitor(DepList * const dd, const std::tr1::shared_ptr<const DestinationsSet> & ddd,
                     const Environment * const, const std::tr1::shared_ptr<const PackageID> &, bool, bool);
             ~ShowSuggestVisitor();
 
diff --git a/paludis/stage_builder_task.cc b/paludis/stage_builder_task.cc
index cdc6094..cd174e2 100644
--- a/paludis/stage_builder_task.cc
+++ b/paludis/stage_builder_task.cc
@@ -66,7 +66,7 @@ StageBuilderTask::~StageBuilderTask()
 }
 
 void
-StageBuilderTask::queue_stage(std::tr1::shared_ptr<const StageBase> p)
+StageBuilderTask::queue_stage(const std::tr1::shared_ptr<const StageBase> & p)
 {
     Context context("When queuing stage in build list:");
     _imp->stages.push_back(p);
diff --git a/paludis/stage_builder_task.hh b/paludis/stage_builder_task.hh
index 172c9d2..54fcc47 100644
--- a/paludis/stage_builder_task.hh
+++ b/paludis/stage_builder_task.hh
@@ -113,7 +113,7 @@ namespace paludis
             ///\name Queue stage in build list
             ///\{
 
-            void queue_stage(std::tr1::shared_ptr<const StageBase>);
+            void queue_stage(const std::tr1::shared_ptr<const StageBase> &);
 
             ///\}
 
@@ -131,11 +131,11 @@ namespace paludis
             ///\{
 
             virtual void on_build_all_pre() = 0;
-            virtual void on_build_pre(std::tr1::shared_ptr<const StageBase>) = 0;
-            virtual void on_build_post(std::tr1::shared_ptr<const StageBase>) = 0;
-            virtual void on_build_fail(std::tr1::shared_ptr<const StageBase>, const StageBuildError &) = 0;
-            virtual void on_build_skipped(std::tr1::shared_ptr<const StageBase>) = 0;
-            virtual void on_build_succeed(std::tr1::shared_ptr<const StageBase>) = 0;
+            virtual void on_build_pre(const std::tr1::shared_ptr<const StageBase> &) = 0;
+            virtual void on_build_post(const std::tr1::shared_ptr<const StageBase> &) = 0;
+            virtual void on_build_fail(const std::tr1::shared_ptr<const StageBase> &, const StageBuildError &) = 0;
+            virtual void on_build_skipped(const std::tr1::shared_ptr<const StageBase> &) = 0;
+            virtual void on_build_succeed(const std::tr1::shared_ptr<const StageBase> &) = 0;
             virtual void on_build_all_post() = 0;
 
             ///\}
diff --git a/paludis/uninstall_list.cc b/paludis/uninstall_list.cc
index bb2963d..aa86372 100644
--- a/paludis/uninstall_list.cc
+++ b/paludis/uninstall_list.cc
@@ -111,13 +111,13 @@ UninstallList::~UninstallList()
 }
 
 void
-UninstallList::add(const std::tr1::shared_ptr<const PackageID> & e, std::tr1::shared_ptr<DepTag> t)
+UninstallList::add(const std::tr1::shared_ptr<const PackageID> & e, const std::tr1::shared_ptr<DepTag> & t)
 {
     real_add(e, t, false);
 }
 
 void
-UninstallList::real_add(const std::tr1::shared_ptr<const PackageID> & e, std::tr1::shared_ptr<DepTag> t,
+UninstallList::real_add(const std::tr1::shared_ptr<const PackageID> & e, const std::tr1::shared_ptr<DepTag> & t,
         const bool error)
 {
     std::list<UninstallListEntry>::iterator i;
@@ -200,7 +200,7 @@ UninstallListOptions::UninstallListOptions() :
 }
 
 void
-UninstallList::add_package(const std::tr1::shared_ptr<const PackageID> & e, std::tr1::shared_ptr<DepTag> t,
+UninstallList::add_package(const std::tr1::shared_ptr<const PackageID> & e, const std::tr1::shared_ptr<DepTag> & t,
         const UninstallListEntryKind k)
 {
     Context context("When adding package '" + stringify(*e) + "' to the uninstall list:");
diff --git a/paludis/uninstall_list.hh b/paludis/uninstall_list.hh
index 8275e11..05e10b7 100644
--- a/paludis/uninstall_list.hh
+++ b/paludis/uninstall_list.hh
@@ -56,10 +56,10 @@ namespace paludis
         public InstantiationPolicy<UninstallList, instantiation_method::NonCopyableTag>
     {
         private:
-            void add_package(const std::tr1::shared_ptr<const PackageID> &, std::tr1::shared_ptr<DepTag>,
+            void add_package(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<DepTag> &,
                     const UninstallListEntryKind k);
             void real_add(const std::tr1::shared_ptr<const PackageID> &,
-                    std::tr1::shared_ptr<DepTag>, const bool);
+                    const std::tr1::shared_ptr<DepTag> &, const bool);
             void move_package_to_end(const std::tr1::shared_ptr<const PackageID> &);
             void add_unused_dependencies();
             void add_dependencies(const PackageID &, const bool);
@@ -89,7 +89,7 @@ namespace paludis
              * Add a package, optionally with a reason.
              */
             void add(const std::tr1::shared_ptr<const PackageID> &,
-                    std::tr1::shared_ptr<DepTag> = std::tr1::shared_ptr<DepTag>());
+                    const std::tr1::shared_ptr<DepTag> & = std::tr1::shared_ptr<DepTag>());
 
             /**
              * Add any unused packages that are dependencies of packages to uninstall.
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 41321ab..e03c8ca 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -445,7 +445,7 @@ namespace
 }
 
 void
-UninstallTask::world_remove_packages(std::tr1::shared_ptr<const SetSpecTree::ConstItem> a)
+UninstallTask::world_remove_packages(const std::tr1::shared_ptr<const SetSpecTree::ConstItem> & a)
 {
     WorldTargetFinder w(_imp->env, this);
     a->accept(w);
diff --git a/paludis/uninstall_task.hh b/paludis/uninstall_task.hh
index 52628a4..51741c3 100644
--- a/paludis/uninstall_task.hh
+++ b/paludis/uninstall_task.hh
@@ -158,7 +158,7 @@ namespace paludis
             ///\{
 
             virtual void world_remove_set(const SetName &);
-            virtual void world_remove_packages(std::tr1::shared_ptr<const SetSpecTree::ConstItem>);
+            virtual void world_remove_packages(const std::tr1::shared_ptr<const SetSpecTree::ConstItem> &);
 
             ///\}
 
diff --git a/paludis/unmerger.cc b/paludis/unmerger.cc
index 9bbea99..1dfb35a 100644
--- a/paludis/unmerger.cc
+++ b/paludis/unmerger.cc
@@ -67,7 +67,7 @@ Unmerger::~Unmerger()
 }
 
 void
-Unmerger::add_unmerge_entry(const std::string & f, EntryType et, std::tr1::shared_ptr<ExtraInfo> ei)
+Unmerger::add_unmerge_entry(const std::string & f, EntryType et, const std::tr1::shared_ptr<ExtraInfo> & ei)
 {
     _imp->unmerge_entries.insert(std::make_pair(f, std::make_pair(et, ei)));
 }
@@ -118,7 +118,7 @@ Unmerger::unmerge()
 }
 
 void
-Unmerger::unmerge_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+Unmerger::unmerge_file(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     FSEntry f_real(_imp->options.root() / f);
 
@@ -144,7 +144,7 @@ Unmerger::unmerge_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
 }
 
 void
-Unmerger::unmerge_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+Unmerger::unmerge_sym(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     FSEntry f_real(_imp->options.root() / f);
 
@@ -170,7 +170,7 @@ Unmerger::unmerge_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
 }
 
 void
-Unmerger::unmerge_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+Unmerger::unmerge_dir(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     FSEntry f_real(_imp->options.root() / f);
 
@@ -191,7 +191,7 @@ Unmerger::unmerge_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
 }
 
 void
-Unmerger::unmerge_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
+Unmerger::unmerge_misc(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) const
 {
     FSEntry f_real(_imp->options.root() / f);
 
@@ -217,7 +217,7 @@ Unmerger::unmerge_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
 }
 
 void
-Unmerger::unlink_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+Unmerger::unlink_file(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (0 != _imp->options.environment()->perform_hook(extend_hook(
                          Hook("unmerger_unlink_file_pre")
@@ -243,7 +243,7 @@ Unmerger::unlink_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
 }
 
 void
-Unmerger::unlink_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+Unmerger::unlink_sym(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (0 != _imp->options.environment()->perform_hook(extend_hook(
                          Hook("unmerger_unlink_sym_pre")
@@ -259,7 +259,7 @@ Unmerger::unlink_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
 }
 
 void
-Unmerger::unlink_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+Unmerger::unlink_dir(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (0 != _imp->options.environment()->perform_hook(extend_hook(
                          Hook("unmerger_unlink_dir_pre")
@@ -275,7 +275,7 @@ Unmerger::unlink_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
 }
 
 void
-Unmerger::unlink_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
+Unmerger::unlink_misc(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
 {
     if (0 != _imp->options.environment()->perform_hook(extend_hook(
                          Hook("unmerger_unlink_misc_pre")
diff --git a/paludis/unmerger.hh b/paludis/unmerger.hh
index ce9ee4b..0307f6e 100644
--- a/paludis/unmerger.hh
+++ b/paludis/unmerger.hh
@@ -116,7 +116,7 @@ namespace paludis
             /**
              * Add entry to the unmerge set.
              */
-            void add_unmerge_entry(const std::string &, EntryType, std::tr1::shared_ptr<ExtraInfo>);
+            void add_unmerge_entry(const std::string &, EntryType, const std::tr1::shared_ptr<ExtraInfo> &);
 
             /**
              * Populate the unmerge set.
@@ -131,32 +131,32 @@ namespace paludis
             ///\name Unmerge operations
             ///\{
 
-            virtual void unmerge_file(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unmerge_dir(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unmerge_sym(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unmerge_misc(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
+            virtual void unmerge_file(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unmerge_dir(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unmerge_sym(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unmerge_misc(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
 
             ///\}
 
             ///\name Check operations
             ///\{
 
-            virtual bool check_file(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const
+            virtual bool check_file(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const
             {
                 return true;
             }
 
-            virtual bool check_dir(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const
+            virtual bool check_dir(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const
             {
                 return true;
             }
 
-            virtual bool check_sym(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const
+            virtual bool check_sym(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const
             {
                 return true;
             }
 
-            virtual bool check_misc(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const
+            virtual bool check_misc(const FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const
             {
                 return true;
             }
@@ -166,10 +166,10 @@ namespace paludis
             ///\name Unlink operations
             ///\{
 
-            virtual void unlink_file(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unlink_dir(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unlink_sym(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
-            virtual void unlink_misc(FSEntry &, std::tr1::shared_ptr<ExtraInfo>) const;
+            virtual void unlink_file(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unlink_dir(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unlink_sym(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
+            virtual void unlink_misc(FSEntry &, const std::tr1::shared_ptr<ExtraInfo> &) const;
 
             ///\}
 
diff --git a/paludis/util/graph.cc b/paludis/util/graph.cc
index 52c5652..fdcdbeb 100644
--- a/paludis/util/graph.cc
+++ b/paludis/util/graph.cc
@@ -28,7 +28,7 @@ GraphError::GraphError(const std::string & msg) throw () :
 }
 
 NoGraphTopologicalOrderExistsError::NoGraphTopologicalOrderExistsError(
-        std::tr1::shared_ptr<const RemainingNodes> r) throw () :
+        const std::tr1::shared_ptr<const RemainingNodes> & r) throw () :
     GraphError("No topological order exists"),
     _remaining_nodes(r)
 {
diff --git a/paludis/util/graph.hh b/paludis/util/graph.hh
index 4caeeea..f6bc7cd 100644
--- a/paludis/util/graph.hh
+++ b/paludis/util/graph.hh
@@ -121,7 +121,7 @@ namespace paludis
             ///\name Basic operations
             ///\{
 
-            NoGraphTopologicalOrderExistsError(std::tr1::shared_ptr<const RemainingNodes>) throw ();
+            NoGraphTopologicalOrderExistsError(const std::tr1::shared_ptr<const RemainingNodes> &) throw ();
             ~NoGraphTopologicalOrderExistsError() throw ();
 
             ///\}
diff --git a/paludis/util/visitor-impl.hh b/paludis/util/visitor-impl.hh
index f5d70bd..46928a9 100644
--- a/paludis/util/visitor-impl.hh
+++ b/paludis/util/visitor-impl.hh
@@ -142,14 +142,14 @@ namespace paludis
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<T_>
+        const std::tr1::shared_ptr<T_>
         TreeLeaf<H_, T_>::item()
         {
             return _item;
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<const T_>
+        const std::tr1::shared_ptr<const T_>
         TreeLeaf<H_, T_>::item() const
         {
             return _item;
@@ -175,21 +175,21 @@ namespace paludis
         }
 
         template <typename H_, typename T_>
-        TreeSequence<H_, T_>::TreeSequence(std::tr1::shared_ptr<T_> i) :
+        TreeSequence<H_, T_>::TreeSequence(const std::tr1::shared_ptr<T_> & i) :
             _item(i),
             _items(new Sequence<std::tr1::shared_ptr<AcceptInterface<H_> > >)
         {
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<const T_>
+        const std::tr1::shared_ptr<const T_>
         TreeSequence<H_, T_>::item() const
         {
             return _item;
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<T_>
+        const std::tr1::shared_ptr<T_>
         TreeSequence<H_, T_>::item()
         {
             return _item;
@@ -197,7 +197,7 @@ namespace paludis
 
         template <typename H_, typename T_>
         void
-        TreeSequence<H_, T_>::add(std::tr1::shared_ptr<AcceptInterface<H_> > i)
+        TreeSequence<H_, T_>::add(const std::tr1::shared_ptr<AcceptInterface<H_> > & i)
         {
             _items->push_back(i);
         }
@@ -247,21 +247,21 @@ namespace paludis
         }
 
         template <typename H_, typename T_>
-        ConstTreeSequence<H_, T_>::ConstTreeSequence(std::tr1::shared_ptr<T_> i) :
+        ConstTreeSequence<H_, T_>::ConstTreeSequence(const std::tr1::shared_ptr<T_> & i) :
             _item(i),
             _items(new Sequence<std::tr1::shared_ptr<const ConstAcceptInterface<H_> > >)
         {
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<T_>
+        const std::tr1::shared_ptr<T_>
         ConstTreeSequence<H_, T_>::item()
         {
             return _item;
         }
 
         template <typename H_, typename T_>
-        std::tr1::shared_ptr<const T_>
+        const std::tr1::shared_ptr<const T_>
         ConstTreeSequence<H_, T_>::item() const
         {
             return _item;
@@ -269,7 +269,7 @@ namespace paludis
 
         template <typename H_, typename T_>
         void
-        ConstTreeSequence<H_, T_>::add(std::tr1::shared_ptr<const ConstAcceptInterface<H_> > i)
+        ConstTreeSequence<H_, T_>::add(const std::tr1::shared_ptr<const ConstAcceptInterface<H_> > & i)
         {
             _items->push_back(i);
         }
diff --git a/paludis/util/visitor.hh b/paludis/util/visitor.hh
index e848812..ba72557 100644
--- a/paludis/util/visitor.hh
+++ b/paludis/util/visitor.hh
@@ -268,9 +268,9 @@ namespace paludis
                 ///\name Fetch our contained item
                 ///\{
 
-                std::tr1::shared_ptr<T_> item();
+                const std::tr1::shared_ptr<T_> item();
 
-                std::tr1::shared_ptr<const T_> item() const;
+                const std::tr1::shared_ptr<const T_> item() const;
 
                 ///\}
         };
@@ -308,23 +308,23 @@ namespace paludis
 
                 virtual ~TreeSequence();
 
-                TreeSequence(std::tr1::shared_ptr<T_> i);
+                TreeSequence(const std::tr1::shared_ptr<T_> & i);
 
                 ///\}
 
                 ///\name Fetch our contained item
                 ///\{
 
-                std::tr1::shared_ptr<const T_> item() const;
+                const std::tr1::shared_ptr<const T_> item() const;
 
-                std::tr1::shared_ptr<T_> item();
+                const std::tr1::shared_ptr<T_> item();
 
                 ///\}
 
                 ///\name Work on our children
                 ///\{
 
-                void add(std::tr1::shared_ptr<AcceptInterface<H_> > i);
+                void add(const std::tr1::shared_ptr<AcceptInterface<H_> > & i);
 
                 typename H_::ConstSequenceIterator
                 const_begin() const;
@@ -372,23 +372,23 @@ namespace paludis
 
                 virtual ~ConstTreeSequence();
 
-                ConstTreeSequence(std::tr1::shared_ptr<T_> i);
+                ConstTreeSequence(const std::tr1::shared_ptr<T_> & i);
 
                 ///\}
 
                 ///\name Fetch our contained item
                 ///\{
 
-                std::tr1::shared_ptr<T_> item();
+                const std::tr1::shared_ptr<T_> item();
 
-                std::tr1::shared_ptr<const T_> item() const;
+                const std::tr1::shared_ptr<const T_> item() const;
 
                 ///\}
 
                 ///\name Work on our children
                 ///\{
 
-                void add(std::tr1::shared_ptr<const ConstAcceptInterface<H_> > i);
+                void add(const std::tr1::shared_ptr<const ConstAcceptInterface<H_> > & i);
 
                 typename H_::ConstSequenceIterator
                 const_begin() const;
diff --git a/python/environment.cc b/python/environment.cc
index 31fca4f..0354402 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -96,7 +96,7 @@ class EnvironmentImplementationWrapper :
                 throw PythonMethodNotImplemented("EnvironmentImplementation", "accept_license");
         }
 
-        virtual bool accept_keywords(std::tr1::shared_ptr<const KeywordNameSet> k, const PackageID & p) const
+        virtual bool accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k, const PackageID & p) const
             PALUDIS_ATTRIBUTE((warn_unused_result))
         {
             Lock l(get_mutex());
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 2061d1b..f2d6daf 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -118,7 +118,7 @@ namespace
 }
 
 int
-do_install(std::tr1::shared_ptr<Environment> env, std::string spec_str)
+do_install(const std::tr1::shared_ptr<Environment> & env, std::string spec_str)
 {
     Context context("When performing install action from command line:");
 
diff --git a/src/clients/contrarius/install.hh b/src/clients/contrarius/install.hh
index ece75b4..42c0f99 100644
--- a/src/clients/contrarius/install.hh
+++ b/src/clients/contrarius/install.hh
@@ -29,6 +29,6 @@
  */
 
 /// Handle --install.
-int do_install(std::tr1::shared_ptr<paludis::Environment>, std::string spec_str);
+int do_install(const std::tr1::shared_ptr<paludis::Environment> &, std::string spec_str);
 
 #endif
diff --git a/src/clients/contrarius/stage.hh b/src/clients/contrarius/stage.hh
index 4d8ffac..5f47211 100644
--- a/src/clients/contrarius/stage.hh
+++ b/src/clients/contrarius/stage.hh
@@ -40,7 +40,7 @@ namespace paludis
             std::tr1::shared_ptr<AdaptedEnvironment> _env;
 
         public:
-            ContrariusStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            ContrariusStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 _env(e)
             {
             }
@@ -50,7 +50,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            AuxiliaryStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            AuxiliaryStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -74,7 +74,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            BinutilsStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            BinutilsStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -98,7 +98,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            KernelHeadersStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            KernelHeadersStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -122,7 +122,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            MinimalStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            MinimalStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -146,7 +146,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            LibCHeadersStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            LibCHeadersStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -170,7 +170,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            LibCStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            LibCStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
@@ -195,7 +195,7 @@ namespace paludis
         public ContrariusStage
     {
         public:
-            FullStage(std::tr1::shared_ptr<AdaptedEnvironment> e) :
+            FullStage(const std::tr1::shared_ptr<AdaptedEnvironment> & e) :
                 ContrariusStage(e)
             {
             }
diff --git a/src/clients/contrarius/stage_builder.cc b/src/clients/contrarius/stage_builder.cc
index 6432b18..db6dc60 100644
--- a/src/clients/contrarius/stage_builder.cc
+++ b/src/clients/contrarius/stage_builder.cc
@@ -55,19 +55,19 @@ OurStageBuilderTask::on_build_all_pre()
 }
 
 void
-OurStageBuilderTask::on_build_pre(std::tr1::shared_ptr<const StageBase> s)
+OurStageBuilderTask::on_build_pre(const std::tr1::shared_ptr<const StageBase> & s)
 {
     cout << colour(cl_heading, "Contents of stage ")
         << colour(cl_stage_short_name, s->short_name()) << endl;
 }
 
 void
-OurStageBuilderTask::on_build_post(std::tr1::shared_ptr<const StageBase>)
+OurStageBuilderTask::on_build_post(const std::tr1::shared_ptr<const StageBase> &)
 {
 }
 
 void
-OurStageBuilderTask::on_build_fail(std::tr1::shared_ptr<const StageBase> s, const StageBuildError & e)
+OurStageBuilderTask::on_build_fail(const std::tr1::shared_ptr<const StageBase> & s, const StageBuildError & e)
 {
     cout << "Build of stage '" << s->short_name() << "' failed:" << endl;
     cout << "Error: " << e.message() << endl << endl;
@@ -75,13 +75,13 @@ OurStageBuilderTask::on_build_fail(std::tr1::shared_ptr<const StageBase> s, cons
 }
 
 void
-OurStageBuilderTask::on_build_succeed(std::tr1::shared_ptr<const StageBase> s)
+OurStageBuilderTask::on_build_succeed(const std::tr1::shared_ptr<const StageBase> & s)
 {
     cout << "Build of stage '" << s->short_name() << "' succeeded." << endl << endl;
 }
 
 void
-OurStageBuilderTask::on_build_skipped(std::tr1::shared_ptr<const StageBase> s)
+OurStageBuilderTask::on_build_skipped(const std::tr1::shared_ptr<const StageBase> & s)
 {
     cout << "Skipped rebuild of stage '" << s->short_name() << "'" << endl << endl;
 }
diff --git a/src/clients/contrarius/stage_builder.hh b/src/clients/contrarius/stage_builder.hh
index f74f922..80349c3 100644
--- a/src/clients/contrarius/stage_builder.hh
+++ b/src/clients/contrarius/stage_builder.hh
@@ -38,12 +38,12 @@ namespace paludis
             }
 
             virtual void on_build_all_pre();
-            virtual void on_build_pre(std::tr1::shared_ptr<const StageBase>);
-            virtual void on_build_post(std::tr1::shared_ptr<const StageBase>);
-            virtual void on_build_fail(std::tr1::shared_ptr<const StageBase>, const StageBuildError &)
+            virtual void on_build_pre(const std::tr1::shared_ptr<const StageBase> &);
+            virtual void on_build_post(const std::tr1::shared_ptr<const StageBase> &);
+            virtual void on_build_fail(const std::tr1::shared_ptr<const StageBase> &, const StageBuildError &)
                 PALUDIS_ATTRIBUTE((noreturn));
-            virtual void on_build_succeed(std::tr1::shared_ptr<const StageBase>);
-            virtual void on_build_skipped(std::tr1::shared_ptr<const StageBase>);
+            virtual void on_build_succeed(const std::tr1::shared_ptr<const StageBase> &);
+            virtual void on_build_skipped(const std::tr1::shared_ptr<const StageBase> &);
             virtual void on_build_all_post();
     };
 }
diff --git a/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.cc
index 9a98622..a652440 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.cc
@@ -84,7 +84,7 @@ CategoriesListModel::populate_in_paludis_thread()
 }
 
 void
-CategoriesListModel::populate_in_gui_thread(std::tr1::shared_ptr<const CategoryNamePartSet> names)
+CategoriesListModel::populate_in_gui_thread(const std::tr1::shared_ptr<const CategoryNamePartSet> & names)
 {
     clear();
     for (CategoryNamePartSet::ConstIterator n(names->begin()), n_end(names->end()) ;
diff --git a/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.hh
index 0e52250..d89f055 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/categories_list_model.hh
@@ -19,7 +19,7 @@ namespace gtkpaludis
     {
         protected:
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const paludis::CategoryNamePartSet> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const paludis::CategoryNamePartSet> & names);
 
         public:
             CategoriesListModel(MainWindow * const m, PackagesPage * const p);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/package_buttons.cc b/src/clients/gtkpaludis/libgtkpaludis/package_buttons.cc
index 06ab229..c9c11f9 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/package_buttons.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/package_buttons.cc
@@ -67,7 +67,7 @@ PackageButtons::populate()
 }
 
 void
-PackageButtons::populate_in_paludis_thread(std::tr1::shared_ptr<const QualifiedPackageName> q)
+PackageButtons::populate_in_paludis_thread(const std::tr1::shared_ptr<const QualifiedPackageName> & q)
 {
     _imp->main_window->gui_thread_action(
             sigc::bind(sigc::mem_fun(this, &PackageButtons::populate_in_gui_thread),
diff --git a/src/clients/gtkpaludis/libgtkpaludis/package_buttons.hh b/src/clients/gtkpaludis/libgtkpaludis/package_buttons.hh
index 81ee876..9e142e3 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/package_buttons.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/package_buttons.hh
@@ -18,7 +18,7 @@ namespace gtkpaludis
         private paludis::PrivateImplementationPattern<PackageButtons>
     {
         private:
-            void populate_in_paludis_thread(std::tr1::shared_ptr<const paludis::QualifiedPackageName>);
+            void populate_in_paludis_thread(const std::tr1::shared_ptr<const paludis::QualifiedPackageName> &);
             void populate_in_gui_thread(const bool, const bool, const bool);
 
         protected:
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_list_filtered_model.hh b/src/clients/gtkpaludis/libgtkpaludis/packages_list_filtered_model.hh
index 8c891cb..5f567fe 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_list_filtered_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_list_filtered_model.hh
@@ -26,7 +26,7 @@ namespace gtkpaludis
             class PopulateData;
 
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const PopulateData> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const PopulateData> & names);
 
         public:
             PackagesListFilteredModel(MainWindow * const m, PackagesPage * const p,
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
index 833c4de..0ee7765 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
@@ -309,7 +309,7 @@ PackagesListModel::populate_in_paludis_thread()
 }
 
 void
-PackagesListModel::populate_in_gui_thread(std::tr1::shared_ptr<const PackagesListModel::PopulateData> names)
+PackagesListModel::populate_in_gui_thread(const std::tr1::shared_ptr<const PackagesListModel::PopulateData> & names)
 {
     clear();
     Gtk::TreeNodeChildren c(children());
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.hh
index 1d4db5a..6e767e0 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.hh
@@ -29,7 +29,7 @@ namespace gtkpaludis
                     PopulateDataIterator);
 
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const PopulateData> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const PopulateData> & names);
 
         public:
             PackagesListModel(MainWindow * const m, PackagesPage * const p);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_page.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_page.cc
index 2fd3632..ab9d574 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_page.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_page.cc
@@ -92,7 +92,7 @@ PackagesPage::populate()
 }
 
 void
-PackagesPage::set_category(std::tr1::shared_ptr<const CategoryNamePart> c)
+PackagesPage::set_category(const std::tr1::shared_ptr<const CategoryNamePart> & c)
 {
     _imp->category = c;
     _imp->set.reset();
@@ -101,7 +101,7 @@ PackagesPage::set_category(std::tr1::shared_ptr<const CategoryNamePart> c)
 }
 
 void
-PackagesPage::set_set(std::tr1::shared_ptr<const SetName> c)
+PackagesPage::set_set(const std::tr1::shared_ptr<const SetName> & c)
 {
     _imp->set = c;
     _imp->category.reset();
@@ -122,7 +122,7 @@ PackagesPage::get_set() const
 }
 
 void
-PackagesPage::set_qpn(std::tr1::shared_ptr<const QualifiedPackageName> q)
+PackagesPage::set_qpn(const std::tr1::shared_ptr<const QualifiedPackageName> & q)
 {
     _imp->qpn = q;
     _imp->package_buttons.populate();
@@ -135,7 +135,7 @@ PackagesPage::get_qpn() const
 }
 
 void
-PackagesPage::set_repository_filter(std::tr1::shared_ptr<const Generator> q)
+PackagesPage::set_repository_filter(const std::tr1::shared_ptr<const Generator> & q)
 {
     _imp->repository_filter = q;
     _imp->categories_list.populate();
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_page.hh b/src/clients/gtkpaludis/libgtkpaludis/packages_page.hh
index 21d7bb3..62e7ef7 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_page.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_page.hh
@@ -26,13 +26,13 @@ namespace gtkpaludis
 
             virtual void populate();
 
-            void set_category(std::tr1::shared_ptr<const paludis::CategoryNamePart>);
+            void set_category(const std::tr1::shared_ptr<const paludis::CategoryNamePart> &);
             std::tr1::shared_ptr<const paludis::CategoryNamePart> get_category() const;
 
-            void set_set(std::tr1::shared_ptr<const paludis::SetName>);
+            void set_set(const std::tr1::shared_ptr<const paludis::SetName> &);
             std::tr1::shared_ptr<const paludis::SetName> get_set() const;
 
-            void set_repository_filter(std::tr1::shared_ptr<const paludis::Generator>);
+            void set_repository_filter(const std::tr1::shared_ptr<const paludis::Generator> &);
             std::tr1::shared_ptr<const paludis::Generator> get_repository_filter() const;
 
             void set_package_filter(const PackagesPackageFilterOption);
@@ -44,7 +44,7 @@ namespace gtkpaludis
             void set_text_filter_text(const std::string &);
             std::string get_text_filter_text() const;
 
-            void set_qpn(std::tr1::shared_ptr<const paludis::QualifiedPackageName>);
+            void set_qpn(const std::tr1::shared_ptr<const paludis::QualifiedPackageName> &);
             std::tr1::shared_ptr<const paludis::QualifiedPackageName> get_qpn() const;
 
     };
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
index e3a5769..6e4608c 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.cc
@@ -81,7 +81,7 @@ PackagesRepositoryFilterModel::populate_in_paludis_thread()
 }
 
 void
-PackagesRepositoryFilterModel::populate_in_gui_thread(std::tr1::shared_ptr<const RepositoryNameSequence> names)
+PackagesRepositoryFilterModel::populate_in_gui_thread(const std::tr1::shared_ptr<const RepositoryNameSequence> & names)
 {
     iterator repositories(append());
     (*repositories)[_imp->columns.col_text] = "Specific repository";
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.hh b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.hh
index 1e2e72d..2be6e95 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_repository_filter_model.hh
@@ -19,7 +19,7 @@ namespace gtkpaludis
     {
         protected:
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const paludis::RepositoryNameSequence> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const paludis::RepositoryNameSequence> & names);
 
         public:
             PackagesRepositoryFilterModel(MainWindow * const m);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.cc
index 1210222..f091d3d 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.cc
@@ -60,7 +60,7 @@ RepositoriesListModel::populate_in_paludis_thread()
 }
 
 void
-RepositoriesListModel::populate_in_gui_thread(std::tr1::shared_ptr<const RepositoryNameSequence> names)
+RepositoriesListModel::populate_in_gui_thread(const std::tr1::shared_ptr<const RepositoryNameSequence> & names)
 {
     clear();
     for (RepositoryNameSequence::ConstIterator n(names->begin()), n_end(names->end()) ;
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.hh
index 1bb19b8..09fff55 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/repositories_list_model.hh
@@ -18,7 +18,7 @@ namespace gtkpaludis
     {
         protected:
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const paludis::RepositoryNameSequence> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const paludis::RepositoryNameSequence> & names);
 
         public:
             RepositoriesListModel(MainWindow * const m);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.cc
index 61d10a5..b07c00d 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.cc
@@ -94,7 +94,7 @@ SetsListModel::populate_in_paludis_thread()
 }
 
 void
-SetsListModel::populate_in_gui_thread(std::tr1::shared_ptr<const SetNameSet> names)
+SetsListModel::populate_in_gui_thread(const std::tr1::shared_ptr<const SetNameSet> & names)
 {
     clear();
     for (SetNameSet::ConstIterator n(names->begin()), n_end(names->end()) ;
diff --git a/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.hh
index 24ad98c..31f5b84 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/sets_list_model.hh
@@ -19,7 +19,7 @@ namespace gtkpaludis
     {
         protected:
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const paludis::SetNameSet> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const paludis::SetNameSet> & names);
 
         public:
             SetsListModel(MainWindow * const m, PackagesPage * const p);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index fca16ce..92723f3 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -300,7 +300,7 @@ namespace gtkpaludis
 }
 
 void
-VersionInfoModel::populate_in_paludis_thread(std::tr1::shared_ptr<const PackageID> p)
+VersionInfoModel::populate_in_paludis_thread(const std::tr1::shared_ptr<const PackageID> & p)
 {
     std::tr1::shared_ptr<PopulateData> data(new PopulateData);
     if (p)
@@ -320,7 +320,7 @@ VersionInfoModel::populate_in_paludis_thread(std::tr1::shared_ptr<const PackageI
 }
 
 void
-VersionInfoModel::populate_in_gui_thread(std::tr1::shared_ptr<const VersionInfoModel::PopulateData> names)
+VersionInfoModel::populate_in_gui_thread(const std::tr1::shared_ptr<const VersionInfoModel::PopulateData> & names)
 {
     clear();
 
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.hh b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.hh
index 79bd7e5..3f3a3f8 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.hh
@@ -25,8 +25,8 @@ namespace gtkpaludis
             class MaskPopulator;
             class PopulateData;
 
-            void populate_in_paludis_thread(std::tr1::shared_ptr<const paludis::PackageID>);
-            void populate_in_gui_thread(std::tr1::shared_ptr<const PopulateData> names);
+            void populate_in_paludis_thread(const std::tr1::shared_ptr<const paludis::PackageID> &);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const PopulateData> & names);
 
         public:
             VersionInfoModel(QueryWindow * const m, VersionsPage * const p);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.cc
index 64ff197..4e4bd7e 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.cc
@@ -135,7 +135,7 @@ VersionsListModel::populate_in_paludis_thread()
 }
 
 void
-VersionsListModel::populate_in_gui_thread(std::tr1::shared_ptr<const VersionsListModel::PopulateData> names)
+VersionsListModel::populate_in_gui_thread(const std::tr1::shared_ptr<const VersionsListModel::PopulateData> & names)
 {
     clear();
 
diff --git a/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.hh b/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.hh
index 0af924e..60a9daa 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/versions_list_model.hh
@@ -22,7 +22,7 @@ namespace gtkpaludis
             class PopulateData;
 
             void populate_in_paludis_thread();
-            void populate_in_gui_thread(std::tr1::shared_ptr<const PopulateData> names);
+            void populate_in_gui_thread(const std::tr1::shared_ptr<const PopulateData> & names);
 
         public:
             VersionsListModel(QueryWindow * const m, VersionsPage * const p);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/versions_page.cc b/src/clients/gtkpaludis/libgtkpaludis/versions_page.cc
index 61fa1af..3cb50c8 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/versions_page.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/versions_page.cc
@@ -58,7 +58,7 @@ VersionsPage::populate()
 }
 
 void
-VersionsPage::set_id(std::tr1::shared_ptr<const PackageID> c)
+VersionsPage::set_id(const std::tr1::shared_ptr<const PackageID> & c)
 {
     _imp->id = c;
     _imp->version_info.populate();
diff --git a/src/clients/gtkpaludis/libgtkpaludis/versions_page.hh b/src/clients/gtkpaludis/libgtkpaludis/versions_page.hh
index 219eb26..edb36cc 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/versions_page.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/versions_page.hh
@@ -24,7 +24,7 @@ namespace gtkpaludis
 
             virtual void populate();
 
-            void set_id(std::tr1::shared_ptr<const paludis::PackageID>);
+            void set_id(const std::tr1::shared_ptr<const paludis::PackageID> &);
             std::tr1::shared_ptr<const paludis::PackageID> get_id() const;
     };
 }
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index acdc8d5..5ec03b1 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -179,7 +179,7 @@ namespace
     };
 }
 
-int do_has_version(std::tr1::shared_ptr<Environment> env)
+int do_has_version(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
@@ -197,7 +197,7 @@ int do_has_version(std::tr1::shared_ptr<Environment> env)
     return return_code;
 }
 
-int do_best_version(std::tr1::shared_ptr<Environment> env)
+int do_best_version(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
@@ -238,7 +238,7 @@ int do_best_version(std::tr1::shared_ptr<Environment> env)
     return return_code;
 }
 
-int do_match(std::tr1::shared_ptr<Environment> env)
+int do_match(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
@@ -281,7 +281,7 @@ int do_match(std::tr1::shared_ptr<Environment> env)
     return return_code;
 }
 
-int do_environment_variable(std::tr1::shared_ptr<Environment> env)
+int do_environment_variable(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
@@ -315,7 +315,7 @@ int do_environment_variable(std::tr1::shared_ptr<Environment> env)
     return return_code;
 }
 
-int do_configuration_variable(std::tr1::shared_ptr<Environment> env)
+int do_configuration_variable(const std::tr1::shared_ptr<Environment> & env)
 {
     Context context("When performing configuration-variable action from command line:");
 
@@ -351,7 +351,7 @@ int do_list_repository_formats()
     return return_code;
 }
 
-int do_list_sync_protocols(std::tr1::shared_ptr<Environment> env)
+int do_list_sync_protocols(const std::tr1::shared_ptr<Environment> & env)
 {
     std::map<std::string, std::string> syncers;
 
@@ -397,7 +397,7 @@ int do_list_sync_protocols(std::tr1::shared_ptr<Environment> env)
     return return_code;
 }
 
-int do_regenerate_cache(std::tr1::shared_ptr<Environment> env, bool installed)
+int do_regenerate_cache(const std::tr1::shared_ptr<Environment> & env, bool installed)
 {
     Context context("When performing cache regeneration action from command line:");
 
diff --git a/src/clients/paludis/applets.hh b/src/clients/paludis/applets.hh
index 2280aa3..768699d 100644
--- a/src/clients/paludis/applets.hh
+++ b/src/clients/paludis/applets.hh
@@ -32,28 +32,28 @@ namespace paludis
 }
 
 /// Handle --has-version.
-int do_has_version(std::tr1::shared_ptr<paludis::Environment>);
+int do_has_version(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --best-version.
-int do_best_version(std::tr1::shared_ptr<paludis::Environment>);
+int do_best_version(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --match.
-int do_match(std::tr1::shared_ptr<paludis::Environment>);
+int do_match(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --environment-variable.
-int do_environment_variable(std::tr1::shared_ptr<paludis::Environment>);
+int do_environment_variable(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --configuration-variable.
-int do_configuration_variable(std::tr1::shared_ptr<paludis::Environment>);
+int do_configuration_variable(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --list-repository-formats
 int do_list_repository_formats();
 
 /// Handle --list-sync-protocols
-int do_list_sync_protocols(std::tr1::shared_ptr<paludis::Environment>);
+int do_list_sync_protocols(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle cache regeneration
-int do_regenerate_cache(std::tr1::shared_ptr<paludis::Environment>, bool installed);
+int do_regenerate_cache(const std::tr1::shared_ptr<paludis::Environment> &, bool installed);
 
 #endif
 
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index 6bb8623..3879454 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -88,7 +88,7 @@ namespace
 }
 
 int
-do_config(std::tr1::shared_ptr<Environment> env)
+do_config(const std::tr1::shared_ptr<Environment> & env)
 {
     int ret_code(0);
 
diff --git a/src/clients/paludis/do_config.hh b/src/clients/paludis/do_config.hh
index f587f7e..57ddb74 100644
--- a/src/clients/paludis/do_config.hh
+++ b/src/clients/paludis/do_config.hh
@@ -32,7 +32,7 @@ namespace paludis
 }
 
 /// Handle --config.
-int do_config(std::tr1::shared_ptr<paludis::Environment>);
+int do_config(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
 
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index b75cadb..2897e89 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -110,7 +110,7 @@ do_one_contents(
 }
 
 int
-do_contents(std::tr1::shared_ptr<Environment> env)
+do_contents(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
diff --git a/src/clients/paludis/do_contents.hh b/src/clients/paludis/do_contents.hh
index 5bc5e7d..91c6ebd 100644
--- a/src/clients/paludis/do_contents.hh
+++ b/src/clients/paludis/do_contents.hh
@@ -28,6 +28,6 @@
 #include <paludis/environment-fwd.hh>
 
 /// Handle --contents.
-int do_contents(std::tr1::shared_ptr<paludis::Environment>);
+int do_contents(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc
index 00d88cd..96a344c 100644
--- a/src/clients/paludis/do_executables.cc
+++ b/src/clients/paludis/do_executables.cc
@@ -140,7 +140,7 @@ do_one_executables(
 }
 
 int
-do_executables(std::tr1::shared_ptr<Environment> env)
+do_executables(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
diff --git a/src/clients/paludis/do_executables.hh b/src/clients/paludis/do_executables.hh
index 6bdef89..481dd40 100644
--- a/src/clients/paludis/do_executables.hh
+++ b/src/clients/paludis/do_executables.hh
@@ -28,6 +28,6 @@
 #include <tr1/memory>
 
 /// Handle --executables.
-int do_executables(std::tr1::shared_ptr<paludis::Environment>);
+int do_executables(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 6371654..c4b61ca 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -151,7 +151,7 @@ namespace
 }
 
 int
-do_install(std::tr1::shared_ptr<Environment> env)
+do_install(const std::tr1::shared_ptr<Environment> & env)
 {
     Context context("When performing install action from command line:");
 
diff --git a/src/clients/paludis/install.hh b/src/clients/paludis/install.hh
index f09ec2f..beb4605 100644
--- a/src/clients/paludis/install.hh
+++ b/src/clients/paludis/install.hh
@@ -32,6 +32,6 @@ namespace paludis
 }
 
 /// Handle --install.
-int do_install(std::tr1::shared_ptr<paludis::Environment>);
+int do_install(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/list.cc b/src/clients/paludis/list.cc
index 4325328..d57edd5 100644
--- a/src/clients/paludis/list.cc
+++ b/src/clients/paludis/list.cc
@@ -39,7 +39,7 @@
 using namespace paludis;
 
 int
-do_list_repositories(std::tr1::shared_ptr<Environment> env)
+do_list_repositories(const std::tr1::shared_ptr<Environment> & env)
 {
     int ret_code(1);
 
@@ -71,7 +71,7 @@ do_list_repositories(std::tr1::shared_ptr<Environment> env)
 }
 
 int
-do_list_categories(std::tr1::shared_ptr<Environment> env)
+do_list_categories(const std::tr1::shared_ptr<Environment> & env)
 {
     int ret_code(1);
 
@@ -124,7 +124,7 @@ do_list_categories(std::tr1::shared_ptr<Environment> env)
 }
 
 int
-do_list_packages(std::tr1::shared_ptr<Environment> env)
+do_list_packages(const std::tr1::shared_ptr<Environment> & env)
 {
     int ret_code(1);
 
@@ -189,7 +189,7 @@ do_list_packages(std::tr1::shared_ptr<Environment> env)
 }
 
 int
-do_list_sets(std::tr1::shared_ptr<Environment> env)
+do_list_sets(const std::tr1::shared_ptr<Environment> & env)
 {
     int ret_code(1);
 
diff --git a/src/clients/paludis/list.hh b/src/clients/paludis/list.hh
index 9adfcf9..cdc5146 100644
--- a/src/clients/paludis/list.hh
+++ b/src/clients/paludis/list.hh
@@ -30,15 +30,15 @@ namespace paludis
 }
 
 /// Handle --list-repositories.
-int do_list_repositories(std::tr1::shared_ptr<paludis::Environment>);
+int do_list_repositories(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --list-categories.
-int do_list_categories(std::tr1::shared_ptr<paludis::Environment>);
+int do_list_categories(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --list-packages.
-int do_list_packages(std::tr1::shared_ptr<paludis::Environment>);
+int do_list_packages(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --list-sets.
-int do_list_sets(std::tr1::shared_ptr<paludis::Environment>);
+int do_list_sets(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/owner.cc b/src/clients/paludis/owner.cc
index 21de5ac..e9917a8 100644
--- a/src/clients/paludis/owner.cc
+++ b/src/clients/paludis/owner.cc
@@ -147,7 +147,7 @@ do_one_owner(
 }
 
 int
-do_owner(std::tr1::shared_ptr<Environment> env)
+do_owner(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
     Context context("When performing owner action from command line:");
diff --git a/src/clients/paludis/owner.hh b/src/clients/paludis/owner.hh
index d554af6..0d87e79 100644
--- a/src/clients/paludis/owner.hh
+++ b/src/clients/paludis/owner.hh
@@ -32,6 +32,6 @@ namespace paludis
 }
 
 /// Handle --owner.
-int do_owner(std::tr1::shared_ptr<paludis::Environment>);
+int do_owner(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index d8caf96..f64f220 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -72,7 +72,7 @@ namespace
 }
 
 void do_one_package_query(
-        const std::tr1::shared_ptr<Environment> env,
+        const std::tr1::shared_ptr<Environment> & env,
         const std::tr1::shared_ptr<Map<char, std::string> > & masks_to_explain,
         std::tr1::shared_ptr<PackageDepSpec> spec)
 {
@@ -109,7 +109,7 @@ namespace
 }
 
 void do_one_set_query(
-        const std::tr1::shared_ptr<Environment>,
+        const std::tr1::shared_ptr<Environment> &,
         const std::string & q,
         const std::tr1::shared_ptr<Map<char, std::string> > &,
         std::tr1::shared_ptr<const SetSpecTree::ConstItem> set)
@@ -122,7 +122,7 @@ void do_one_set_query(
 }
 
 void do_one_query(
-        const std::tr1::shared_ptr<Environment> env,
+        const std::tr1::shared_ptr<Environment> & env,
         const std::string & q,
         const std::tr1::shared_ptr<Map<char, std::string> > & masks_to_explain)
 {
@@ -139,7 +139,7 @@ void do_one_query(
     }
 }
 
-int do_query(std::tr1::shared_ptr<Environment> env)
+int do_query(const std::tr1::shared_ptr<Environment> & env)
 {
     int return_code(0);
 
diff --git a/src/clients/paludis/query.hh b/src/clients/paludis/query.hh
index 800b14f..faa53cb 100644
--- a/src/clients/paludis/query.hh
+++ b/src/clients/paludis/query.hh
@@ -32,6 +32,6 @@ namespace paludis
 }
 
 /// Handle --query.
-int do_query(std::tr1::shared_ptr<paludis::Environment>);
+int do_query(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
diff --git a/src/clients/paludis/report.cc b/src/clients/paludis/report.cc
index a4b0d87..709c7cc 100644
--- a/src/clients/paludis/report.cc
+++ b/src/clients/paludis/report.cc
@@ -186,7 +186,7 @@ namespace
     }
 }
 
-int do_report(std::tr1::shared_ptr<Environment> env)
+int do_report(const std::tr1::shared_ptr<Environment> & env)
 {
     Context context("When performing report action from command line:");
 
diff --git a/src/clients/paludis/report.hh b/src/clients/paludis/report.hh
index b484293..394ce7b 100644
--- a/src/clients/paludis/report.hh
+++ b/src/clients/paludis/report.hh
@@ -32,7 +32,7 @@ namespace paludis
 }
 
 /// Handle --report.
-int do_report(std::tr1::shared_ptr<paludis::Environment>);
+int do_report(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
 
diff --git a/src/clients/paludis/sync.cc b/src/clients/paludis/sync.cc
index ce4ba7e..fc465eb 100644
--- a/src/clients/paludis/sync.cc
+++ b/src/clients/paludis/sync.cc
@@ -118,7 +118,7 @@ namespace
     }
 }
 
-int do_sync(std::tr1::shared_ptr<Environment> env)
+int do_sync(const std::tr1::shared_ptr<Environment> & env)
 {
     Context context("When performing sync action from command line:");
 
diff --git a/src/clients/paludis/sync.hh b/src/clients/paludis/sync.hh
index 91d5f07..ab33cd5 100644
--- a/src/clients/paludis/sync.hh
+++ b/src/clients/paludis/sync.hh
@@ -32,7 +32,7 @@ namespace paludis
 }
 
 /// Handle --sync.
-int do_sync(std::tr1::shared_ptr<paludis::Environment>);
+int do_sync(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
 
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index c3505e6..488d36a 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -328,13 +328,13 @@ namespace
 }
 
 int
-do_uninstall(std::tr1::shared_ptr<Environment> env)
+do_uninstall(const std::tr1::shared_ptr<Environment> & env)
 {
     return real_uninstall(env, false);
 }
 
 int
-do_uninstall_unused(std::tr1::shared_ptr<Environment> env)
+do_uninstall_unused(const std::tr1::shared_ptr<Environment> & env)
 {
     return real_uninstall(env, true);
 }
diff --git a/src/clients/paludis/uninstall.hh b/src/clients/paludis/uninstall.hh
index 297bd0c..946dfb4 100644
--- a/src/clients/paludis/uninstall.hh
+++ b/src/clients/paludis/uninstall.hh
@@ -32,10 +32,10 @@ namespace paludis
 }
 
 /// Handle --uninstall.
-int do_uninstall(std::tr1::shared_ptr<paludis::Environment>);
+int do_uninstall(const std::tr1::shared_ptr<paludis::Environment> &);
 
 /// Handle --uninstall-unused.
-int do_uninstall_unused(std::tr1::shared_ptr<paludis::Environment>);
+int do_uninstall_unused(const std::tr1::shared_ptr<paludis::Environment> &);
 
 #endif
 
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 3a817b1..770068a 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -127,7 +127,7 @@ UseDescriptionComparator::operator() (const UseDescription & lhs, const UseDescr
 
 ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
         const DepListOptions & options,
-        std::tr1::shared_ptr<const DestinationsSet> d) :
+        const std::tr1::shared_ptr<const DestinationsSet> & d) :
     InstallTask(env, options, d),
     _download_size(0),
     _download_size_overflow(false),
@@ -861,7 +861,7 @@ ConsoleInstallTask::display_tag_summary_tag_pre_text(const DepTagCategory & c)
 }
 
 void
-ConsoleInstallTask::display_tag_summary_tag(std::tr1::shared_ptr<const DepTag> t)
+ConsoleInstallTask::display_tag_summary_tag(const std::tr1::shared_ptr<const DepTag> & t)
 {
     std::tr1::shared_ptr<DepTagSummaryDisplayer> displayer(make_dep_tag_summary_displayer());
     t->accept(*displayer.get());
@@ -1032,8 +1032,8 @@ ConsoleInstallTask::display_merge_list_entry_slot(const DepListEntry & d, const
 
 void
 ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepListEntry & d,
-        std::tr1::shared_ptr<const PackageIDSequence> existing_repo,
-        std::tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
+        const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo,
+        const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo,
         const DisplayMode m)
 {
     switch (m)
@@ -1137,8 +1137,8 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
 
 void
 ConsoleInstallTask::display_merge_list_entry_description(const DepListEntry & d,
-        std::tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
-        std::tr1::shared_ptr<const PackageIDSequence>,
+        const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo,
+        const std::tr1::shared_ptr<const PackageIDSequence> &,
         const DisplayMode m)
 {
     if ((! d.package_id->short_description_key()) || d.package_id->short_description_key()->value().empty())
@@ -1175,7 +1175,7 @@ ConsoleInstallTask::display_merge_list_entry_description(const DepListEntry & d,
 }
 
 void
-ConsoleInstallTask::_add_descriptions(std::tr1::shared_ptr<const UseFlagNameSet> c,
+ConsoleInstallTask::_add_descriptions(const std::tr1::shared_ptr<const UseFlagNameSet> & c,
         const std::tr1::shared_ptr<const PackageID> & p, UseDescriptionState s)
 {
     for (UseFlagNameSet::ConstIterator f(c->begin()), f_end(c->end()) ;
@@ -1209,8 +1209,8 @@ ConsoleInstallTask::_add_descriptions(std::tr1::shared_ptr<const UseFlagNameSet>
 
 void
 ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
-        std::tr1::shared_ptr<const PackageIDSequence> existing_repo,
-        std::tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
+        const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo,
+        const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo,
         const DisplayMode m)
 {
     if (normal_entry != m && suggested_entry != m)
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 99335a9..d123ed9 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -120,14 +120,14 @@ namespace paludis
             std::tr1::shared_ptr<UseFlagNameSet> _all_expand_prefixes;