aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-02 00:07:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-07 11:32:55 +0000
commitd02f6611a083735106d0f56d6d49f3a4743a5d07 (patch)
tree8f6c8f0d4ef825bb6eee30bd0d19623263dddb31
parentb09f30261089985bd08c79a12d7df7f11b348a84 (diff)
downloadpaludis-d02f6611a083735106d0f56d6d49f3a4743a5d07.tar.gz
paludis-d02f6611a083735106d0f56d6d49f3a4743a5d07.tar.xz
Don't store id
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc16
-rw-r--r--paludis/repositories/e/e_key.cc25
-rw-r--r--paludis/repositories/e/e_key.hh3
-rw-r--r--paludis/repositories/e/ebuild_id.cc10
4 files changed, 20 insertions, 34 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 32174b2..92e521e 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -220,7 +220,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! env->env_use().empty())
if ((_imp->dir / env->env_use()).stat().exists())
{
- _imp->keys->raw_use = std::make_shared<EStringSetKey>(shared_from_this(), env->env_use(), env->description_use(),
+ _imp->keys->raw_use = std::make_shared<EStringSetKey>(env->env_use(), env->description_use(),
file_contents(_imp->dir / env->env_use()), mkt_internal);
add_metadata_key(_imp->keys->raw_use);
}
@@ -236,7 +236,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->inherited()->name().empty())
if ((_imp->dir / vars->inherited()->name()).stat().exists())
{
- _imp->keys->inherited = std::make_shared<EStringSetKey>(shared_from_this(), vars->inherited()->name(), vars->inherited()->description(),
+ _imp->keys->inherited = std::make_shared<EStringSetKey>(vars->inherited()->name(), vars->inherited()->description(),
file_contents(_imp->dir / vars->inherited()->name()), mkt_internal);
add_metadata_key(_imp->keys->inherited);
}
@@ -247,7 +247,7 @@ EInstalledRepositoryID::need_keys_added() const
std::string d(file_contents(_imp->dir / vars->defined_phases()->name()));
if (! d.empty())
{
- _imp->keys->defined_phases = std::make_shared<EStringSetKey>(shared_from_this(), vars->defined_phases()->name(), vars->defined_phases()->description(),
+ _imp->keys->defined_phases = std::make_shared<EStringSetKey>(vars->defined_phases()->name(), vars->defined_phases()->description(),
d, mkt_internal);
add_metadata_key(_imp->keys->defined_phases);
}
@@ -256,13 +256,13 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->iuse()->name().empty())
{
if ((_imp->dir / vars->iuse()->name()).stat().exists())
- _imp->keys->raw_iuse = std::make_shared<EStringSetKey>(shared_from_this(), vars->iuse()->name(), vars->iuse()->description(),
+ _imp->keys->raw_iuse = std::make_shared<EStringSetKey>(vars->iuse()->name(), vars->iuse()->description(),
file_contents(_imp->dir / vars->iuse()->name()), mkt_internal);
else
{
/* hack: if IUSE doesn't exist, we still need an iuse_key to make the choices
* code behave sanely. */
- _imp->keys->raw_iuse = std::make_shared<EStringSetKey>(shared_from_this(), vars->iuse()->name(), vars->iuse()->description(),
+ _imp->keys->raw_iuse = std::make_shared<EStringSetKey>(vars->iuse()->name(), vars->iuse()->description(),
"", mkt_internal);
}
add_metadata_key(_imp->keys->raw_iuse);
@@ -273,7 +273,7 @@ EInstalledRepositoryID::need_keys_added() const
if ((_imp->dir / vars->iuse_effective()->name()).stat().exists())
{
_imp->keys->raw_iuse_effective = std::make_shared<EStringSetKey>(
- shared_from_this(), vars->iuse_effective()->name(), vars->iuse_effective()->description(),
+ vars->iuse_effective()->name(), vars->iuse_effective()->description(),
file_contents(_imp->dir / vars->iuse_effective()->name()), mkt_internal);
add_metadata_key(_imp->keys->raw_iuse_effective);
}
@@ -298,7 +298,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->use_expand()->name().empty())
if ((_imp->dir / vars->use_expand()->name()).stat().exists())
{
- _imp->keys->raw_use_expand = std::make_shared<EStringSetKey>(shared_from_this(), vars->use_expand()->name(), vars->use_expand()->description(),
+ _imp->keys->raw_use_expand = std::make_shared<EStringSetKey>(vars->use_expand()->name(), vars->use_expand()->description(),
file_contents(_imp->dir / vars->use_expand()->name()), mkt_internal);
add_metadata_key(_imp->keys->raw_use_expand);
}
@@ -306,7 +306,7 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->use_expand_hidden()->name().empty())
if ((_imp->dir / vars->use_expand_hidden()->name()).stat().exists())
{
- _imp->keys->raw_use_expand_hidden = std::make_shared<EStringSetKey>(shared_from_this(), vars->use_expand_hidden()->name(), vars->use_expand_hidden()->description(),
+ _imp->keys->raw_use_expand_hidden = std::make_shared<EStringSetKey>(vars->use_expand_hidden()->name(), vars->use_expand_hidden()->description(),
file_contents(_imp->dir / vars->use_expand_hidden()->name()), mkt_internal);
add_metadata_key(_imp->keys->raw_use_expand_hidden);
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 8013de3..abde8a9 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -869,30 +869,25 @@ namespace paludis
template <>
struct Imp<EStringSetKey>
{
- const std::shared_ptr<const ERepositoryID> id;
- const std::string string_value;
- mutable Mutex value_mutex;
- mutable std::shared_ptr<Set<std::string> > value;
+ const std::shared_ptr<Set<std::string> > value;
const std::string raw_name;
const std::string human_name;
const MetadataKeyType type;
- Imp(const std::shared_ptr<const ERepositoryID> & i, const std::string & v,
- const std::string & r, const std::string & h, const MetadataKeyType t) :
- id(i),
- string_value(v),
+ Imp(const std::string & v, const std::string & r, const std::string & h, const MetadataKeyType t) :
+ value(std::make_shared<Set<std::string> >()),
raw_name(r),
human_name(h),
type(t)
{
+ tokenise_whitespace(v, value->inserter());
}
};
}
-EStringSetKey::EStringSetKey(const std::shared_ptr<const ERepositoryID> & id,
- const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- Pimp<EStringSetKey>(id, v, r, h, t)
+EStringSetKey::EStringSetKey(const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
+ Pimp<EStringSetKey>(v, r, h, t)
{
}
@@ -903,14 +898,6 @@ EStringSetKey::~EStringSetKey()
const std::shared_ptr<const Set<std::string> >
EStringSetKey::value() const
{
- Lock l(_imp->value_mutex);
-
- if (_imp->value)
- return _imp->value;
-
- _imp->value = std::make_shared<Set<std::string>>();
- Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- tokenise_whitespace(_imp->string_value, _imp->value->inserter());
return _imp->value;
}
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 4b80c20..e1cfba5 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -275,8 +275,7 @@ namespace paludis
private Pimp<EStringSetKey>
{
public:
- EStringSetKey(const std::shared_ptr<const ERepositoryID> &,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ EStringSetKey(const std::string &, const std::string &, const std::string &, const MetadataKeyType);
~EStringSetKey();
const std::shared_ptr<const Set<std::string> > value() const
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 00f10cb..4182065 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1057,7 +1057,7 @@ void
EbuildID::load_iuse(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->raw_iuse = std::make_shared<EStringSetKey>(shared_from_this(), r, h, v, mkt_internal);
+ _imp->raw_iuse = std::make_shared<EStringSetKey>(r, h, v, mkt_internal);
add_metadata_key(_imp->raw_iuse);
}
@@ -1081,7 +1081,7 @@ void
EbuildID::load_use(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->raw_use = std::make_shared<EStringSetKey>(shared_from_this(), r, h, v, mkt_internal);
+ _imp->raw_use = std::make_shared<EStringSetKey>(r, h, v, mkt_internal);
add_metadata_key(_imp->raw_use);
}
@@ -1097,7 +1097,7 @@ void
EbuildID::load_inherited(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->inherited = std::make_shared<EStringSetKey>(shared_from_this(), r, h, v, mkt_internal);
+ _imp->inherited = std::make_shared<EStringSetKey>(r, h, v, mkt_internal);
add_metadata_key(_imp->inherited);
}
@@ -1108,7 +1108,7 @@ EbuildID::load_defined_phases(const std::string & r, const std::string & h, cons
throw InternalError(PALUDIS_HERE, "v should not be empty");
Lock l(_imp->mutex);
- _imp->defined_phases = std::make_shared<EStringSetKey>(shared_from_this(), r, h, v, mkt_internal);
+ _imp->defined_phases = std::make_shared<EStringSetKey>(r, h, v, mkt_internal);
add_metadata_key(_imp->defined_phases);
}
@@ -1164,7 +1164,7 @@ void
EbuildID::load_generated_from(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->generated_from = std::make_shared<EStringSetKey>(shared_from_this(), r, h, v, mkt_normal);
+ _imp->generated_from = std::make_shared<EStringSetKey>(r, h, v, mkt_normal);
add_metadata_key(_imp->generated_from);
}