Re: [PATCH v3 47/48] util: allow identity to be imported/exported as typed parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2019-07-29 at 18:11 +0100, Daniel P. Berrangé wrote:
> +++ b/src/util/viridentity.c
> +int virIdentitySetParameters(virIdentityPtr ident,
> +                             virTypedParameterPtr params,
> +                             int nparams)

Return type on a separate line.

[...]
> +    virTypedParamsFree(ident->params, ident->nparams);
> +    ident->params = NULL;
> +    ident->nparams = 0;

I'm obviously a bit unclear on some pretty fundamental details of
the virTypedParam API.

More specifically: shouldn't you set

  ident->maxparams = 0;

here as well? I don't see how it could work otherwise.

> +    if (virTypedParamsCopy(&ident->params, params, nparams) < 0)
> +        return -1;
> +    ident->nparams = nparams;

And here too, don't you need to do

  ident->maxparams = ident->nparams;

for subsequent calls to virTypedParamAdd*() to know whether they need
to allocate additional memeory?

[...]
> +int virIdentityGetParameters(virIdentityPtr ident,
> +                             virTypedParameterPtr *params,
> +                             int *nparams)

Return type on a separate line.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux