qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof()


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof()
Date: Mon, 19 Aug 2019 14:09:41 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 8/19/19 1:55 PM, Max Reitz wrote:
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2-snapshot.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

What, the file got larger in spite of using a helper macro for ease of
readability?  Good thing that 'lines of code' is not the only metric of
goodness ;)

> 
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index d0e7fa9311..752883e5c3 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -92,11 +92,12 @@ int qcow2_read_snapshots(BlockDriverState *bs)
>          }
>          offset += extra_data_size;
>  
> -        if (extra_data_size >= 8) {
> +        if (extra_data_size >= endof(QCowSnapshotExtraData,
> +                                     vm_state_size_large)) {
>              sn->vm_state_size = be64_to_cpu(extra.vm_state_size_large);
>          }
>  
> -        if (extra_data_size >= 16) {
> +        if (extra_data_size >= endof(QCowSnapshotExtraData, disk_size)) {

Yes, that is nicer.

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]