[Geany-Devel] On document pointer recycling

Lex Trotman elextr at xxxxx
Thu Oct 24 21:51:30 UTC 2013


On 25 October 2013 04:04, Dimitar Zhekov <dimitar.zhekov at gmail.com> wrote:

> 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.
>

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.

Cheers
Lex


>
> --
> E-gards: Jimmy
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20131025/06b73386/attachment-0001.html>


More information about the Devel mailing list