On Mon, Aug 29, 2016 at 12:31:44 -0400, John Ferlan wrote:
> +int
> +virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
> + char **name)
> +{
> + if (VIR_RESIZE_N(cpuModels->models, cpuModels->alloc,
> + cpuModels->count, 1) < 0)
> + return -1;
> +
> + cpuModels->models[cpuModels->count++].name = *name;
> + *name = NULL;
Similar to VIR_STEAL_PTR with the added count++ twist...
Right, I changed it to use VIR_STEAL_PTR.
...
> diff --git a/src/conf/domain_capabilities.h
b/src/conf/domain_capabilities.h
> index 492a9cf..509c306 100644
> --- a/src/conf/domain_capabilities.h
> +++ b/src/conf/domain_capabilities.h
> @@ -102,6 +102,30 @@ struct _virDomainCapsFeatureGIC {
> virDomainCapsEnum version; /* Info about virGICVersion */
> };
>
> +typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
> +typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
> +struct _virDomainCapsCPUModel {
> + char *name;
> +};
> +
> +typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
> +typedef virDomainCapsCPUModels *virDomainCapsCPUModelsPtr;
> +struct _virDomainCapsCPUModels {
> + virObject parent;
> +
> + size_t alloc;
> + size_t count;
Easier for me to read/see "->nmodels_max" and "->nmodels"...
Not sure
how pervasive it is to change... Not a requirement, your call...
Yeah, nmodels{,_max} is more common in our code base. Fixed.
Jirka