[Geany-Devel] On document pointer recycling
dimitar.zhekov at xxxxx
Thu Oct 24 17:04:28 UTC 2013
On Thu, 24 Oct 2013 19:22:34 +1100
Lex Trotman <elextr at 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.
That being said, just how is a list better than a GPtrArray?
More information about the Devel