qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 09/14] block/qcow2: qcow2_get_specific_info(): drop error pro


From: Alberto Garcia
Subject: Re: [PATCH 09/14] block/qcow2: qcow2_get_specific_info(): drop error propagation
Date: Thu, 17 Sep 2020 18:32:56 +0200
User-agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu)

On Wed 09 Sep 2020 08:59:25 PM CEST, Vladimir Sementsov-Ogievskiy 
<vsementsov@virtuozzo.com> wrote:

> + * On success return true with bm_list set (probably to NULL, if no bitmaps),

" probably " ? :-)

> + * on failure return false with errp set.
>   */
> -Qcow2BitmapInfoList *qcow2_get_bitmap_info_list(BlockDriverState *bs,
> -                                                Error **errp)
> +bool qcow2_get_bitmap_info_list(BlockDriverState *bs,
> +                                Qcow2BitmapInfoList **info_list, Error 
> **errp)
>  {
>      BDRVQcow2State *s = bs->opaque;
>      Qcow2BitmapList *bm_list;
>      Qcow2Bitmap *bm;
> -    Qcow2BitmapInfoList *list = NULL;
> -    Qcow2BitmapInfoList **plist = &list;

So here 'list' points at NULL and 'plist' at &list.

> -        *plist = obj;
> -        plist = &obj->next;

In the original code 'plist' is updated when you add a new element, so
it always points at the end of the list. But 'list' is unchanged and it
still points at the first element.

So the caller receives a pointer to the first element.

> +        *info_list = obj;
> +        info_list = &obj->next;

But in the new code there is only one variable (passed by the caller),
which always points at the end of the list.

Berto



reply via email to

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