[folks] IndividualAggregator: assert and assume that _link_map[key][i] != null
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] IndividualAggregator: assert and assume that _link_map[key][i] != null
- Date: Tue, 2 Apr 2013 16:46:20 +0000 (UTC)
commit c438d6d00ad5e513d09315a8cbe285cd1436794d
Author: Simon McVittie <simon mcvittie collabora co uk>
Date: Thu Mar 28 12:17:38 2013 +0000
IndividualAggregator: assert and assume that _link_map[key][i] != null
The link map's type is non-nullable, and when we add individuals
to the link map we do so through a function that does not allow
a null argument, so we don't need to sprinkle (!) casts around.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687161
Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
Reviewed-by: Philip Withnall <philip tecnocode co uk>
folks/individual-aggregator.vala | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 841ade3..705b34c 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -1127,19 +1127,17 @@ public class Folks.IndividualAggregator : Object
this._link_map.get (persona.iid);
if (candidates != null)
{
- for (uint i = 0; i < candidates.length; i++)
+ for (uint i = 0; i < ((!) candidates).length; i++)
{
- /* FIXME: can this really be null? */
- unowned Individual? candidate_ind = candidates[i];
+ var candidate_ind = ((!) candidates)[i];
- if (candidate_ind != null &&
- ((!) candidate_ind).trust_level != TrustLevel.NONE &&
- ((!) candidate_ind).has_anti_link_with_persona (
+ if (candidate_ind.trust_level != TrustLevel.NONE &&
+ candidate_ind.has_anti_link_with_persona (
persona) == false &&
- candidate_inds.add ((!) candidate_ind))
+ candidate_inds.add (candidate_ind))
{
debug (" Found candidate individual '%s' by " +
- "IID '%s'.", ((!) candidate_ind).id, persona.iid);
+ "IID '%s'.", candidate_ind.id, persona.iid);
}
}
}
@@ -1175,22 +1173,20 @@ public class Folks.IndividualAggregator : Object
if (candidates != null)
{
- for (uint i = 0; i < candidates.length; i++)
+ for (uint i = 0; i < ((!) candidates).length; i++)
{
- /* FIXME: can this really be null? */
- unowned Individual? candidate_ind = candidates[i];
+ var candidate_ind = ((!) candidates)[i];
- if (candidate_ind != null &&
- ((!) candidate_ind).trust_level !=
+ if (candidate_ind.trust_level !=
TrustLevel.NONE &&
- ((!) candidate_ind).
+ candidate_ind.
has_anti_link_with_persona (
persona) == false &&
- candidate_inds.add ((!) candidate_ind))
+ candidate_inds.add (candidate_ind))
{
debug (" Found candidate individual '%s'" +
" by linkable property '%s' = '%s'.",
- ((!) candidate_ind).id, prop_name,
+ candidate_ind.id, prop_name,
prop_linking_value);
}
}
@@ -1376,7 +1372,7 @@ public class Folks.IndividualAggregator : Object
if (inds == null)
{
inds = new GenericArray<Individual> ();
- this._link_map.insert (key, inds);
+ this._link_map.insert (key, (!) inds);
}
else
{
@@ -1666,6 +1662,7 @@ public class Folks.IndividualAggregator : Object
for (uint i = 0; i < inds.length; i++)
{
var individual = inds[i];
+ assert (individual != null);
if (this._individuals.get (individual.id) != individual)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]