[libvirt] [libvirt-designer][PATCH 0/3] Another cleanup

to address Chritophe's improvements hints. Michal Privoznik (3): init_check: Ignore DB loading errors get_supported_disk_bus_types: NULL is valid list add_disk_full: Only set error if !NULL libvirt-designer/libvirt-designer-domain.c | 5 ++--- libvirt-designer/libvirt-designer-main.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) -- 1.7.8.6

Osinfo DB loader returns an error if users have a malformed XML file. However, it doesn't affect loading of other files, so we should not make those errors fatal. In addition, if osinfo DB is empty users will obtain appropriate error on very next API involving querying the DB. --- libvirt-designer/libvirt-designer-main.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/libvirt-designer/libvirt-designer-main.c b/libvirt-designer/libvirt-designer-main.c index f2381a6..5c70b57 100644 --- a/libvirt-designer/libvirt-designer-main.c +++ b/libvirt-designer/libvirt-designer-main.c @@ -89,9 +89,7 @@ gboolean gvir_designer_init_check(int *argc, /* XXX maybe we want to let users tell a different path via * env variable or argv */ osinfo_loader = osinfo_loader_new(); - osinfo_loader_process_default_path(osinfo_loader, err); - if (err) - return FALSE; + osinfo_loader_process_default_path(osinfo_loader, NULL); osinfo_db = osinfo_loader_get_db(osinfo_loader); -- 1.7.8.6

There is no need to check return value of g_hash_table_get_keys() which is passed to g_list_copy as even NULL is valid list in glib. --- libvirt-designer/libvirt-designer-domain.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index de69241..0d441df 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -701,8 +701,7 @@ gvir_designer_domain_get_supported_disk_bus_types(GVirDesignerDomain *design) } ret = g_hash_table_get_keys(bus_hash); - if (ret) - ret = g_list_copy(ret); + ret = g_list_copy(ret); cleanup: g_hash_table_destroy(bus_hash); -- 1.7.8.6

--- libvirt-designer/libvirt-designer-domain.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index 0d441df..194fdf5 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -820,7 +820,7 @@ gvir_designer_domain_add_disk_full(GVirDesignerDomain *design, /* And fallback if fails */ bus_str_list = gvir_designer_domain_get_supported_disk_bus_types(design); if (!bus_str_list) { - if (!*error) + if (error && !*error) g_set_error(error, GVIR_DESIGNER_DOMAIN_ERROR, 0, "Unable to find any disk bus type"); goto error; -- 1.7.8.6

On 09/12/2012 05:09 PM, Michal Privoznik wrote:
to address Chritophe's improvements hints.
Michal Privoznik (3): init_check: Ignore DB loading errors get_supported_disk_bus_types: NULL is valid list add_disk_full: Only set error if !NULL
libvirt-designer/libvirt-designer-domain.c | 5 ++--- libvirt-designer/libvirt-designer-main.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)
Three small patches, all of them make sense, so ACK series. Martin

On 13.09.2012 10:57, Christophe Fergeau wrote:
Hey,
On Wed, Sep 12, 2012 at 05:09:32PM +0200, Michal Privoznik wrote:
to address Chritophe's improvements hints.
Ah thanks for polishing these small nits, series looks good to me too.
Christophe
Thank you guys, pushed. Michal
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (3)
-
Christophe Fergeau
-
Martin Kletzander
-
Michal Privoznik