[Libosinfo] [RFC PATCH 2/5] osinfo_loader: avoid multiple calls to OSINFO_ENTITY
Daniel P. Berrange
berrange at redhat.com
Tue Jun 3 14:23:09 UTC 2014
On Tue, Jun 03, 2014 at 04:08:09PM +0200, Giuseppe Scrivano wrote:
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
> osinfo/osinfo_loader.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index aa5e48f..a767bb8 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -1657,19 +1657,20 @@ osinfo_loader_process_file_reg_ids(OsinfoLoader *loader,
> baseURI, vendor_id, device_id);
>
> OsinfoDevice *dev = osinfo_loader_get_device(loader, id);
> - osinfo_entity_set_param(OSINFO_ENTITY(dev),
> + OsinfoEntity *entity = OSINFO_ENTITY(dev);
> + osinfo_entity_set_param(entity,
> OSINFO_DEVICE_PROP_VENDOR_ID,
> vendor_id);
> - osinfo_entity_set_param(OSINFO_ENTITY(dev),
> + osinfo_entity_set_param(entity,
> OSINFO_DEVICE_PROP_VENDOR,
> vendor);
> - osinfo_entity_set_param(OSINFO_ENTITY(dev),
> + osinfo_entity_set_param(entity,
> OSINFO_DEVICE_PROP_PRODUCT_ID,
> device_id);
> - osinfo_entity_set_param(OSINFO_ENTITY(dev),
> + osinfo_entity_set_param(entity,
> OSINFO_DEVICE_PROP_PRODUCT,
> device);
> - osinfo_entity_set_param(OSINFO_ENTITY(dev),
> + osinfo_entity_set_param(entity,
> OSINFO_DEVICE_PROP_BUS_TYPE,
> busType);
> g_free(id);
Does this change actually have a measurable performance benefit ?
If it does have a measurable benefit, then ACK, but otherwise I
tend to prefer the code as it is really.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the Libosinfo
mailing list