always return NULL in _unref() APIs
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.
1 file changed