[libvirt] [PATCH 1/3] qemuProcessStop: Set @def early

Michal Privoznik mprivozn at redhat.com
Tue Nov 19 09:29:57 UTC 2019


On 11/19/19 10:04 AM, Erik Skultety wrote:
> On Tue, Nov 19, 2019 at 09:58:42AM +0100, Michal Privoznik wrote:
>> The @def variable holds pointer to the domain defintion, but is
>> set only somewhere in the middle of the function. This is
>> suboptimal.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>   src/qemu/qemu_process.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>> index 90ebdb43a0..8cb12ac9a6 100644
>> --- a/src/qemu/qemu_process.c
>> +++ b/src/qemu/qemu_process.c
>> @@ -7365,6 +7365,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
>>           goto endjob;
>>       }
>>
>> +    def = vm->def;
> 
> Maybe even less confusing - how about initializing it during the variable
> declaration at the very beginning of the function?
> 
> Reviewed-by: Erik Skultety <eskultet at redhat.com>
> 

Good point, fixed and pushed.

Thanks,
Michal




More information about the libvir-list mailing list