Hi Li,

On Tue, Sep 01, 2015 at 06:56 AM CEST, eshark <eshar...@163.com> wrote:
>   I wonder why the sd_bus_slot_unref() always returns NULL? I expect
>   that I can check whether the slot->n_ref ==0 by checking its return
>   value.

It is my understanding that NULL is returned so that you can release the
reference and nullify the pointer holding the reference in one line:

        ref = sd_bus_slot_unref(ref);

This idiom prevents the access-after-release programming errors.

Cheers,
Jakub
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to