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:
Thomas Haller
2019-02-27 16:54:43 +01:00
parent ac4a1deba0
commit 2c37a3fb1e

View File

@@ -632,9 +632,11 @@ nmp_object_ref (const NMPObject *obj)
static inline void
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) \