platform: add NULL check in inline nmp_object_unref() function
This allows the compiler to see that this function does nothing for %NULL. That is not so unusual, as we use nm_auto_nmpobj to free objects. Often the compiler can see that these pointers are %NULL.
This commit is contained in:
@@ -632,10 +632,12 @@ nmp_object_ref (const NMPObject *obj)
|
|||||||
static inline void
|
static inline void
|
||||||
nmp_object_unref (const NMPObject *obj)
|
nmp_object_unref (const NMPObject *obj)
|
||||||
{
|
{
|
||||||
nm_assert (!obj || NMP_OBJECT_IS_VALID (obj));
|
if (obj) {
|
||||||
|
nm_assert (NMP_OBJECT_IS_VALID (obj));
|
||||||
|
|
||||||
nm_dedup_multi_obj_unref ((const NMDedupMultiObj *) obj);
|
nm_dedup_multi_obj_unref ((const NMDedupMultiObj *) obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define nm_clear_nmp_object(ptr) \
|
#define nm_clear_nmp_object(ptr) \
|
||||||
({ \
|
({ \
|
||||||
|
Reference in New Issue
Block a user