[object] Remove unnecessary use of macros
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 7d1925f..435d37b 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -87,7 +87,7 @@
{
hb_blob_t *blob;
- if (!length || !HB_OBJECT_DO_CREATE (hb_blob_t, blob)) {
+ if (!length || !(blob = hb_object_create<hb_blob_t> ())) {
if (destroy)
destroy (user_data);
return &_hb_blob_nil;
@@ -122,7 +122,7 @@
hb_blob_t *blob;
const char *pdata;
- if (!length || offset >= parent->length || !HB_OBJECT_DO_CREATE (hb_blob_t, blob))
+ if (!length || offset >= parent->length || !(blob = hb_object_create<hb_blob_t> ()))
return &_hb_blob_nil;
pdata = hb_blob_lock (parent);
@@ -149,13 +149,13 @@
hb_blob_t *
hb_blob_reference (hb_blob_t *blob)
{
- HB_OBJECT_DO_REFERENCE (blob);
+ return hb_object_reference (blob);
}
void
hb_blob_destroy (hb_blob_t *blob)
{
- HB_OBJECT_DO_DESTROY (blob);
+ if (!hb_object_destroy (blob)) return;
_hb_blob_destroy_user_data (blob);
@@ -171,7 +171,7 @@
const char *
hb_blob_lock (hb_blob_t *blob)
{
- if (HB_OBJECT_IS_INERT (blob))
+ if (hb_object_is_inert (blob))
return NULL;
hb_mutex_lock (blob->lock);
@@ -190,7 +190,7 @@
void
hb_blob_unlock (hb_blob_t *blob)
{
- if (HB_OBJECT_IS_INERT (blob))
+ if (hb_object_is_inert (blob))
return;
hb_mutex_lock (blob->lock);
@@ -210,7 +210,7 @@
{
hb_memory_mode_t mode;
- if (HB_OBJECT_IS_INERT (blob))
+ if (hb_object_is_inert (blob))
return FALSE;
hb_mutex_lock (blob->lock);
@@ -292,7 +292,7 @@
{
hb_memory_mode_t mode;
- if (HB_OBJECT_IS_INERT (blob))
+ if (hb_object_is_inert (blob))
return FALSE;
hb_mutex_lock (blob->lock);
@@ -312,7 +312,7 @@
{
hb_memory_mode_t mode;
- if (HB_OBJECT_IS_INERT (blob))
+ if (hb_object_is_inert (blob))
return FALSE;
hb_mutex_lock (blob->lock);
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 5468270..2ae29ca 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -137,7 +137,7 @@
{
hb_buffer_t *buffer;
- if (!HB_OBJECT_DO_CREATE (hb_buffer_t, buffer))
+ if (!(buffer = hb_object_create<hb_buffer_t> ()))
return &_hb_buffer_nil;
if (pre_alloc_size)
@@ -151,13 +151,13 @@
hb_buffer_t *
hb_buffer_reference (hb_buffer_t *buffer)
{
- HB_OBJECT_DO_REFERENCE (buffer);
+ return hb_object_reference (buffer);
}
void
hb_buffer_destroy (hb_buffer_t *buffer)
{
- HB_OBJECT_DO_DESTROY (buffer);
+ if (!hb_object_destroy (buffer)) return;
hb_unicode_funcs_destroy (buffer->unicode);
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 149ca19..5506480 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -102,7 +102,7 @@
{
hb_font_funcs_t *ffuncs;
- if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
+ if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
return &_hb_font_funcs_nil;
ffuncs->v = _hb_font_funcs_nil.v;
@@ -113,13 +113,13 @@
hb_font_funcs_t *
hb_font_funcs_reference (hb_font_funcs_t *ffuncs)
{
- HB_OBJECT_DO_REFERENCE (ffuncs);
+ return hb_object_reference (ffuncs);
}
void
hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
{
- HB_OBJECT_DO_DESTROY (ffuncs);
+ if (!hb_object_destroy (ffuncs)) return;
free (ffuncs);
}
@@ -129,7 +129,7 @@
{
hb_font_funcs_t *ffuncs;
- if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
+ if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
return &_hb_font_funcs_nil;
ffuncs->v = other_ffuncs->v;
@@ -140,7 +140,7 @@
void
hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs)
{
- if (HB_OBJECT_IS_INERT (ffuncs))
+ if (hb_object_is_inert (ffuncs))
return;
ffuncs->immutable = TRUE;
@@ -308,7 +308,7 @@
{
hb_face_t *face;
- if (!HB_OBJECT_DO_CREATE (hb_face_t, face)) {
+ if (!(face = hb_object_create<hb_face_t> ())) {
if (destroy)
destroy (user_data);
return &_hb_face_nil;
@@ -389,13 +389,13 @@
hb_face_t *
hb_face_reference (hb_face_t *face)
{
- HB_OBJECT_DO_REFERENCE (face);
+ return hb_object_reference (face);
}
void
hb_face_destroy (hb_face_t *face)
{
- HB_OBJECT_DO_DESTROY (face);
+ if (!hb_object_destroy (face)) return;
_hb_ot_layout_free (face->ot_layout);
@@ -454,7 +454,7 @@
{
hb_font_t *font;
- if (!HB_OBJECT_DO_CREATE (hb_font_t, font))
+ if (!(font = hb_object_create<hb_font_t> ()))
return &_hb_font_nil;
font->klass = &_hb_font_funcs_nil;
@@ -465,13 +465,13 @@
hb_font_t *
hb_font_reference (hb_font_t *font)
{
- HB_OBJECT_DO_REFERENCE (font);
+ return hb_object_reference (font);
}
void
hb_font_destroy (hb_font_t *font)
{
- HB_OBJECT_DO_DESTROY (font);
+ if (!hb_object_destroy (font)) return;
hb_font_funcs_destroy (font->klass);
if (font->destroy)
@@ -486,7 +486,7 @@
void *user_data,
hb_destroy_func_t destroy)
{
- if (HB_OBJECT_IS_INERT (font))
+ if (hb_object_is_inert (font))
return;
if (font->destroy)
@@ -514,7 +514,7 @@
*user_data = font->user_data;
*destroy = font->destroy;
- if (HB_OBJECT_IS_INERT (font))
+ if (hb_object_is_inert (font))
return;
font->klass = NULL;
@@ -527,7 +527,7 @@
int x_scale,
int y_scale)
{
- if (HB_OBJECT_IS_INERT (font))
+ if (hb_object_is_inert (font))
return;
font->x_scale = x_scale;
@@ -548,7 +548,7 @@
unsigned int x_ppem,
unsigned int y_ppem)
{
- if (HB_OBJECT_IS_INERT (font))
+ if (hb_object_is_inert (font))
return;
font->x_ppem = x_ppem;
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index c3cdeb5..8fbddd4 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -123,18 +123,9 @@
}
-
HB_BEGIN_DECLS
-/* Object allocation and lifecycle manamgement macros */
-
-#define HB_OBJECT_DO_CREATE(Type, obj) likely (obj = hb_object_create<Type> ())
-#define HB_OBJECT_IS_INERT(obj) hb_object_is_inert (obj)
-#define HB_OBJECT_DO_REFERENCE(obj) return hb_object_reference (obj)
-#define HB_OBJECT_DO_DESTROY(obj) if (!hb_object_destroy (obj)) return
-
-
HB_END_DECLS
#endif /* HB_OBJECT_PRIVATE_HH */
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index b756461..9922955 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -107,7 +107,7 @@
{
hb_unicode_funcs_t *ufuncs;
- if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
+ if (!(ufuncs = hb_object_create<hb_unicode_funcs_t> ()))
return &_hb_unicode_funcs_nil;
if (parent != NULL)
@@ -133,13 +133,13 @@
hb_unicode_funcs_t *
hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs)
{
- HB_OBJECT_DO_REFERENCE (ufuncs);
+ return hb_object_reference (ufuncs);
}
void
hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
{
- HB_OBJECT_DO_DESTROY (ufuncs);
+ if (!hb_object_destroy (ufuncs)) return;
#define DESTROY(name) if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name)
DESTROY (combining_class);
@@ -158,7 +158,7 @@
void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
{
- if (HB_OBJECT_IS_INERT (ufuncs))
+ if (hb_object_is_inert (ufuncs))
return;
ufuncs->immutable = TRUE;