diff --git a/lib/filterx/filterx-object.c b/lib/filterx/filterx-object.c index 5c962e1e7..260ca1286 100644 --- a/lib/filterx/filterx-object.c +++ b/lib/filterx/filterx-object.c @@ -131,37 +131,6 @@ filterx_object_unfreeze_and_free(FilterXObject *self) filterx_object_unref(self); } -FilterXObject * -filterx_object_ref(FilterXObject *self) -{ - if (!self) - return NULL; - - if (filterx_object_is_frozen(self)) - return self; - - g_atomic_counter_inc(&self->ref_cnt); - - return self; -} - -void -filterx_object_unref(FilterXObject *self) -{ - if (!self) - return; - - if (filterx_object_is_frozen(self)) - return; - - g_assert(g_atomic_counter_get(&self->ref_cnt) > 0); - if (g_atomic_counter_dec_and_test(&self->ref_cnt)) - { - self->type->free_fn(self); - g_free(self); - } -} - FilterXType FILTERX_TYPE_NAME(object) = { .super_type = NULL, diff --git a/lib/filterx/filterx-object.h b/lib/filterx/filterx-object.h index 2faee0049..e321cf16c 100644 --- a/lib/filterx/filterx-object.h +++ b/lib/filterx/filterx-object.h @@ -102,8 +102,6 @@ FilterXObject *filterx_object_getattr_string(FilterXObject *self, const gchar *a gboolean filterx_object_setattr_string(FilterXObject *self, const gchar *attr_name, FilterXObject **new_value); FilterXObject *filterx_object_new(FilterXType *type); -FilterXObject *filterx_object_ref(FilterXObject *self); -void filterx_object_unref(FilterXObject *self); gboolean filterx_object_freeze(FilterXObject *self); void filterx_object_unfreeze_and_free(FilterXObject *self); void filterx_object_init_instance(FilterXObject *self, FilterXType *type); @@ -115,6 +113,37 @@ filterx_object_is_frozen(FilterXObject *self) return g_atomic_counter_get(&self->ref_cnt) == FILTERX_OBJECT_MAGIC_BIAS; } +static inline FilterXObject * +filterx_object_ref(FilterXObject *self) +{ + if (!self) + return NULL; + + if (filterx_object_is_frozen(self)) + return self; + + g_atomic_counter_inc(&self->ref_cnt); + + return self; +} + +static inline void +filterx_object_unref(FilterXObject *self) +{ + if (!self) + return; + + if (filterx_object_is_frozen(self)) + return; + + g_assert(g_atomic_counter_get(&self->ref_cnt) > 0); + if (g_atomic_counter_dec_and_test(&self->ref_cnt)) + { + self->type->free_fn(self); + g_free(self); + } +} + static inline void filterx_object_make_readonly(FilterXObject *self) {