[PATCH 2/2] lib: Use g_steal_pointer() more

Peter Krempa pkrempa at redhat.com
Wed Mar 24 14:51:46 UTC 2021


On Wed, Mar 24, 2021 at 11:27:07 +0100, Michal Privoznik wrote:
> Generated by the following spatch:
> 
>   @@
>   expression a, b;
>   @@
> 
>   + b = g_steal_pointer(&a);
>   - b = a;
>     ... when != a
>   - a = NULL;
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---

./dist-unpack/libvirt-7.2.0/src/rpc/virnetsocket.c:2159:10: error: pointer type mismatch ('virFreeCallback' (aka 'void (*)(void *)') and 'gpointer' (aka 'void *')) [-Werror,-Wpointer-type-mismatch]
    ff = g_steal_pointer(&sock->ff);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmem.h:217:6: note: expanded from macro 'g_steal_pointer'
  (0 ? (*(pp)) : (g_steal_pointer) (pp))
     ^ ~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

https://gitlab.com/libvirt/libvirt/-/jobs/1124093339




More information about the libvir-list mailing list