On 3/21/24 16:28, Jonathon Jongsma wrote:
> +void
> +nodeDeviceDefResetMdevActiveConfig(virNodeDeviceDef *def)
> +{
> + size_t i = 0;
> + virMediatedDeviceConfig *active_config;
> +
> + if (def->caps->data.type != VIR_NODE_DEV_CAP_MDEV)
> + return;
> +
> + active_config = &def->caps->data.mdev.active_config;
> +
> + g_clear_pointer(&active_config->type, g_free);
> + for (i = 0; i < active_config->nattributes; i++)
> + virMediatedDeviceAttrFree(active_config->attributes[i]);
> + g_clear_pointer(&active_config->attributes, g_free);
> + active_config->nattributes = 0;
> +}
> +
> +
A good portion of this function is duplicating code that exists in
virNodeDevCapsDefFree(). Let's just factor that code out into a
virMediatedDeviceConfigClear() function and then use it from both
locations.
OK, will do.
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294