[libvirt] [PATCH v2 12/12] migration: refactor: one return in forURI family functions

Nikolay Shirokovskiy nshirokovskiy at parallels.com
Fri Sep 18 13:12:21 UTC 2015



On 17.09.2015 18:22, John Ferlan wrote:
> 
> 
> On 09/10/2015 09:20 AM, Nikolay Shirokovskiy wrote:
>> May be a matter of a taste but this version with one return point in every
>> function looks simplier to understand and to exetend too. Anyway after such
> 
> s/exetend/extend
> 
>> a heavy refactoring a little cleanup will not hurt.
>>
>> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
>> ---
>>  src/libvirt-domain.c |   61 +++++++++++++++++++++++---------------------------
>>  1 files changed, 28 insertions(+), 33 deletions(-)
>>
> 
> Although I know Daniel has ACK'd already - I figured I'd complete it too...
> 
> BTW: I can confirm the following will work in ToURI3:
> 
> const char *duri = (flags & VIR_MIGRATE_PEER2PEER) ? dconnuri : NULL;
> ...
> 
> Remove the dconnuri = NULL, replace 'dconnuri' with 'duri' in the
> virDomainMigrateUnmanagedParams call and Coverity stops complaining.
> 
> Curiously, I see the *ToURI2 function has a similar construct without a
> complaint, but it's calling virDomainMigrateUnmanaged and I'll assume
> Coverity gets sufficiently boggled with the call path that it doesn't
> matter. Your call if you want to change the *ToURI2 function to use a
> local static...
> 
I think that we'd probably better just check for not null in toURI2
and toURI3 under p2p check. Not sure for Coverity but this check
is a good input parameter check. I'll propose this as a new patch.




More information about the libvir-list mailing list