On 10/20/19 2:55 PM, Ján Tomko wrote:
Use a temporary variable to allow copying from the currently set source. Always return 0 since none of the callers distinguishes between 0 and 1 propagated from VIR_STRDUP. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/conf/domain_conf.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 88e93f6fb8..cd9b6ca993 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2139,15 +2139,10 @@ virDomainDiskGetSource(virDomainDiskDef const *def) int virDomainDiskSetSource(virDomainDiskDefPtr def, const char *src) { - int ret; - char *tmp = def->src->path; - - ret = VIR_STRDUP(def->src->path, src); - if (ret < 0) - def->src->path = tmp; - else - VIR_FREE(tmp); - return ret; + char *tmp = g_strdup(src); + g_free(def->src->path); + def->src->path = tmp; + return 0; }
So what I did in my patches was also turn this function to void. Do we want that or not?
Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list