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

Michal Privoznik mprivozn at redhat.com
Wed Mar 24 15:15:29 UTC 2021


On 3/24/21 3:51 PM, Peter Krempa wrote:
> 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
> 

Okay, I blame glib. I don't know how to silence the error so I'll revert 
this particular hunk. Also, glib--. It's biting me more and more lately.

Michal




More information about the libvir-list mailing list