Commit 17923978 authored by Niels De Graef's avatar Niels De Graef

edsf: Avoid Gee.LinkedList in copy_contacts(_ids)

When we receive a signal that adds/removes/changes contacts, we get a
list of the affectefd contacts (or their ID's). Since we process them at
a separate point in time in the main loop, we have to make a copy to
make sure that they're still around when being processed.

The current way we do this, is by creating a `Gee.LinkedList`, and
appending each entry at the end (note that appending an item is an O(1)
operation in `Gee.LinkedList` since it keeps track of its last element).
However, there's some problems with this approach:

* Each time an element is added into the list, a little helper object (a
  `Node`) is allocated. This is yet again just another unnecessary
  allocation that we wish to avoid.
* Iterating over any `Gee.Collection` gives you an owned reference to
  each element, meaning we do unnecessary copies or reference count

Most of these issues can be solved quite elegantly by using
`GLib.GenericArray` (ie. `GPtrArray`), which will keep track of the
owned references, but won't try to do anything fancy with it.
parent 25d83d3e
Pipeline #234436 passed with stages
in 6 minutes and 26 seconds