[PATCH] domain_conf: make virDomainDiskSetSource() void

Matt Coleman mcoleman at datto.com
Thu Nov 5 20:43:31 UTC 2020


> On Nov 5, 2020, at 11:26 AM, Michal Prívozník <mprivozn at redhat.com> wrote:
> 
> With us adopting glib more and more cleanups like these will be desirable more. Any plans on continuing?

I discovered this when I tried to call this function without wrapping 
it with ignore_value(). I hadn't taken a look for other functions that 
might be in a similar state.

I also could go a bit further with this function's rewrite: the tmp 
variable isn't actually necessary any longer since g_strdup() will 
abort on failure. So, the function might as well be just two lines: 
g_free() followed by g_strdup().

After looking over the rest of domain_conf.c, I've decided to produce a 
V2 patchset that eliminates the tmp variable in 
virDomainDiskSetSource() and addresses several other similar issues 
with other functions in the file.

-- 
Matt





More information about the libvir-list mailing list