[libvirt RFC 20/24] qemu_snapshot: prepare data for external snapshot deletion
Peter Krempa
pkrempa at redhat.com
Thu Oct 13 07:32:31 UTC 2022
On Wed, Oct 12, 2022 at 17:19:23 +0200, Pavel Hrdina wrote:
> On Tue, Sep 06, 2022 at 12:19:38PM +0200, Peter Krempa wrote:
> > On Tue, Aug 23, 2022 at 18:32:23 +0200, Pavel Hrdina wrote:
[...]
> > > +
> > > +
> > > +static GPtrArray*
> > > +qemuSnapshotDeleteExternalPrepare(virDomainObj *vm,
> > > + virDomainMomentObj *snap)
> > > +{
> > > + ssize_t i;
> > > + virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
> > > + g_autoptr(GPtrArray) ret = g_ptr_array_new_full(0, g_free);
> >
> > Is there any specific requirement to access these randomly?
> > (specifically why GPtrArray is used instead of e.g. a G(S)List?
>
> There is no need to access these randomly but G(S)List doesn't work that
> nicely with g_autoptr and dynamically allocated elements. For this case
> we would have to use g_list_free_full().
Sure, but you also have g_autoslist/g_autolist, so you can also use
automatic cleanup.
More information about the libvir-list
mailing list