chiark / gitweb /
libudev: always return NULL in _unref() APIs
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2013 00:15:31 +0000 (01:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 18:36:14 +0000 (19:36 +0100)
Returning anything else but NULL would suggest the caller's reference
might still be valid, but it isn't, because the caller just invoked
_unref() after all.

This turns the return value into a typesafe shortcut that allows
unreffing and resetting a reference in one line. In contrast to
solutions for this which take a pointer to a pointer to accomplish the
same this solution is just syntactic sugar the developer can make use of
but doesn't have to, and this is particularly useful when immediately
unreffing objects returned by function calls.


No differences found