mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 06:30:33 +01:00
shared: move nm_dedup_multi_obj_ref() to header as inline
nm_dedup_multi_obj_ref() is a trivial function, that only uses the field which is already declared in the same header file. Move it to the header so that it can be inlined (without LTO).
This commit is contained in:
parent
9acf80a979
commit
f7616eee1e
2 changed files with 16 additions and 17 deletions
|
|
@ -871,22 +871,6 @@ nm_dedup_multi_index_obj_intern (NMDedupMultiIndex *self,
|
|||
return obj_new;
|
||||
}
|
||||
|
||||
const NMDedupMultiObj *
|
||||
nm_dedup_multi_obj_ref (const NMDedupMultiObj *obj)
|
||||
{
|
||||
/* ref and unref accept const pointers. Objects is supposed to be shared
|
||||
* and kept immutable. Disallowing to take/retrun a reference to a const
|
||||
* NMPObject is cumbersome, because callers are precisely expected to
|
||||
* keep a ref on the otherwise immutable object. */
|
||||
|
||||
nm_assert (obj);
|
||||
nm_assert (obj->_ref_count != NM_OBJ_REF_COUNT_STACKINIT);
|
||||
nm_assert (obj->_ref_count > 0);
|
||||
|
||||
((NMDedupMultiObj *) obj)->_ref_count++;
|
||||
return obj;
|
||||
}
|
||||
|
||||
const NMDedupMultiObj *
|
||||
nm_dedup_multi_obj_unref (const NMDedupMultiObj *obj)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,7 +78,22 @@ struct _NMDedupMultiObjClass {
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
const NMDedupMultiObj *nm_dedup_multi_obj_ref (const NMDedupMultiObj *obj);
|
||||
static inline const NMDedupMultiObj *
|
||||
nm_dedup_multi_obj_ref (const NMDedupMultiObj *obj)
|
||||
{
|
||||
/* ref and unref accept const pointers. Objects is supposed to be shared
|
||||
* and kept immutable. Disallowing to take/retrun a reference to a const
|
||||
* NMPObject is cumbersome, because callers are precisely expected to
|
||||
* keep a ref on the otherwise immutable object. */
|
||||
|
||||
nm_assert (obj);
|
||||
nm_assert (obj->_ref_count != NM_OBJ_REF_COUNT_STACKINIT);
|
||||
nm_assert (obj->_ref_count > 0);
|
||||
|
||||
((NMDedupMultiObj *) obj)->_ref_count++;
|
||||
return obj;
|
||||
}
|
||||
|
||||
const NMDedupMultiObj *nm_dedup_multi_obj_unref (const NMDedupMultiObj *obj);
|
||||
const NMDedupMultiObj *nm_dedup_multi_obj_clone (const NMDedupMultiObj *obj);
|
||||
gboolean nm_dedup_multi_obj_needs_clone (const NMDedupMultiObj *obj);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue