On 13-10-24 02:51 PM, Lex Trotman wrote:
On 25 October 2013 04:04, Dimitar Zhekov <dimitar.zhe...@gmail.com> wrote:
On Thu, 24 Oct 2013 19:22:34 +1100
Lex Trotman <ele...@gmail.com> wrote:
Unfortunately there is an accessor document_index() in the plugin
interface
that uses the index into the array.
Switching to a list means that there needs to be a change everywhere in
Geany and the plugins that the array index is used instead of a pointer.
I
don't see anywhere where the index is used inside Geany but I may have
missed somewhere. I don't know how often its used by plugins. But again
its use could be deprecated and a temporary map (eg g_tree) from an int
to
the pointer could be used until plugins are modified.
From what I see, document_index() is used in the plugins:
- inside foreach_document(i), which makes zero sense
- in a similar loop in codenav, where the number of documents is
copied in a local variable, without an obvious reason, and there
is no is_valid check
- in geanypy, to implement a Python document_index() function.
Thanks.
That being said, just how is a list better than a GPtrArray?
True, its the fact that the index is held constant because it might be
stored and re-used that stops the array from being shrunk. Getting rid of
the use of indexes is the necessary pre-condition for shrinking the array,
or using a list or whatever.
We could use GHashTable as a Set to contain the documents internally
afterwards. It doesn't make much sense to have a particular document
instantiated more than once anyway and the only order we care about for
documents here is maybe the order/time they were opened, which is better
solved with a "open timestamp" or something, IMO.
My two cents
Cheers,
Matthew Brush
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel