summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-09-22 13:38:41 +0200
committerThomas Haller <thaller@redhat.com>2017-09-26 11:30:58 +0200
commit7a4413bfd2eb4b8840d2ec3b92a5e6865695464a (patch)
tree497df556c6900b94d7edd0328165131b320ef759
parent166002ca667c2f0081b411ee94f331d6f37231b6 (diff)
downloadNetworkManager-7a4413bfd2eb4b8840d2ec3b92a5e6865695464a.tar.gz
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).
-rw-r--r--shared/nm-utils/nm-dedup-multi.c16
-rw-r--r--shared/nm-utils/nm-dedup-multi.h17
2 files changed, 16 insertions, 17 deletions
diff --git a/shared/nm-utils/nm-dedup-multi.c b/shared/nm-utils/nm-dedup-multi.c
index 51a866abca..a1b6da114d 100644
--- a/shared/nm-utils/nm-dedup-multi.c
+++ b/shared/nm-utils/nm-dedup-multi.c
@@ -872,22 +872,6 @@ nm_dedup_multi_index_obj_intern (NMDedupMultiIndex *self,
}
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)
{
if (obj) {
diff --git a/shared/nm-utils/nm-dedup-multi.h b/shared/nm-utils/nm-dedup-multi.h
index 387ab98e78..ecce791d42 100644
--- a/shared/nm-utils/nm-dedup-multi.h
+++ b/shared/nm-utils/nm-dedup-multi.h
@@ -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);