[libvirt] [PATCH 03/34] conf: use g_strdup in virDomainDiskSet
Ján Tomko
jtomko at redhat.com
Tue Oct 22 13:35:38 UTC 2019
On Mon, Oct 21, 2019 at 11:39:14AM +0200, Michal Privoznik wrote:
>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 at redhat.com>
>>---
>> 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?
>
Eventually. I don't think it belongs to the VIR_STRDUP -> g_strdup
conversion.
Jano
>Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191022/da334b48/attachment-0001.sig>
More information about the libvir-list
mailing list