Index: third_party/harfbuzz-ng/src/hb-gobject-structs.cc |
diff --git a/third_party/harfbuzz-ng/src/hb-gobject-structs.cc b/third_party/harfbuzz-ng/src/hb-gobject-structs.cc |
index cec48542275b84a7897338b58eb2d36ebf3a451a..2451b66291bfbc1d03505ed39626f90a2bc39ae0 100644 |
--- a/third_party/harfbuzz-ng/src/hb-gobject-structs.cc |
+++ b/third_party/harfbuzz-ng/src/hb-gobject-structs.cc |
@@ -37,27 +37,84 @@ |
#include "hb-gobject.h" |
-#define _HB_DEFINE_BOXED_TYPE(Name,underscore_name,copy_func,free_func) \ |
+#define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \ |
GType \ |
-underscore_name##_get_type (void) \ |
+hb_gobject_##name##_get_type (void) \ |
{ \ |
- static volatile gsize type = 0; \ |
- if (g_once_init_enter (&type)) { \ |
- GType t = g_boxed_type_register_static (g_intern_static_string (#Name), \ |
- (GBoxedCopyFunc) copy_func, \ |
- (GBoxedFreeFunc) free_func); \ |
- g_once_init_leave (&type, t); \ |
+ static gsize type_id = 0; \ |
+ if (g_once_init_enter (&type_id)) { \ |
+ GType id = g_boxed_type_register_static (g_intern_static_string ("hb_" #name "_t"), \ |
+ (GBoxedCopyFunc) copy_func, \ |
+ (GBoxedFreeFunc) free_func); \ |
+ g_once_init_leave (&type_id, id); \ |
} \ |
- return type; \ |
+ return type_id; \ |
} |
-#define HB_DEFINE_BOXED_TYPE(name) \ |
- _HB_DEFINE_BOXED_TYPE (hb_##name, hb_gobject_##name, hb_##name##_reference, hb_##name##_destroy); |
+#define HB_DEFINE_OBJECT_TYPE(name) \ |
+ HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy); |
-HB_DEFINE_BOXED_TYPE (buffer) |
-HB_DEFINE_BOXED_TYPE (blob) |
-HB_DEFINE_BOXED_TYPE (face) |
-HB_DEFINE_BOXED_TYPE (font) |
-HB_DEFINE_BOXED_TYPE (font_funcs) |
-HB_DEFINE_BOXED_TYPE (unicode_funcs) |
+HB_DEFINE_OBJECT_TYPE (buffer) |
+HB_DEFINE_OBJECT_TYPE (blob) |
+HB_DEFINE_OBJECT_TYPE (face) |
+HB_DEFINE_OBJECT_TYPE (font) |
+HB_DEFINE_OBJECT_TYPE (font_funcs) |
+HB_DEFINE_OBJECT_TYPE (set) |
+HB_DEFINE_OBJECT_TYPE (shape_plan) |
+HB_DEFINE_OBJECT_TYPE (unicode_funcs) |
+ |
+static hb_feature_t *feature_reference (hb_feature_t *g) |
+{ |
+ hb_feature_t *c = (hb_feature_t *) calloc (1, sizeof (hb_feature_t)); |
+ if (unlikely (!c)) return NULL; |
+ *c = *g; |
+ return c; |
+} |
+static void feature_destroy (hb_feature_t *g) { free (g); } |
+HB_DEFINE_BOXED_TYPE (feature, feature_reference, feature_destroy) |
+ |
+static hb_glyph_info_t *glyph_info_reference (hb_glyph_info_t *g) |
+{ |
+ hb_glyph_info_t *c = (hb_glyph_info_t *) calloc (1, sizeof (hb_glyph_info_t)); |
+ if (unlikely (!c)) return NULL; |
+ *c = *g; |
+ return c; |
+} |
+static void glyph_info_destroy (hb_glyph_info_t *g) { free (g); } |
+HB_DEFINE_BOXED_TYPE (glyph_info, glyph_info_reference, glyph_info_destroy) |
+ |
+static hb_glyph_position_t *glyph_position_reference (hb_glyph_position_t *g) |
+{ |
+ hb_glyph_position_t *c = (hb_glyph_position_t *) calloc (1, sizeof (hb_glyph_position_t)); |
+ if (unlikely (!c)) return NULL; |
+ *c = *g; |
+ return c; |
+} |
+static void glyph_position_destroy (hb_glyph_position_t *g) { free (g); } |
+HB_DEFINE_BOXED_TYPE (glyph_position, glyph_position_reference, glyph_position_destroy) |
+ |
+static hb_segment_properties_t *segment_properties_reference (hb_segment_properties_t *g) |
+{ |
+ hb_segment_properties_t *c = (hb_segment_properties_t *) calloc (1, sizeof (hb_segment_properties_t)); |
+ if (unlikely (!c)) return NULL; |
+ *c = *g; |
+ return c; |
+} |
+static void segment_properties_destroy (hb_segment_properties_t *g) { free (g); } |
+HB_DEFINE_BOXED_TYPE (segment_properties, segment_properties_reference, segment_properties_destroy) |
+ |
+static hb_user_data_key_t user_data_key_reference (hb_user_data_key_t l) { return l; } |
+static void user_data_key_destroy (hb_user_data_key_t l) { } |
+HB_DEFINE_BOXED_TYPE (user_data_key, user_data_key_reference, user_data_key_destroy) |
+ |
+ |
+static hb_language_t *language_reference (hb_language_t *l) |
+{ |
+ hb_language_t *c = (hb_language_t *) calloc (1, sizeof (hb_language_t)); |
+ if (unlikely (!c)) return NULL; |
+ *c = *l; |
+ return c; |
+} |
+static void language_destroy (hb_language_t *l) { free (l); } |
+HB_DEFINE_BOXED_TYPE (language, language_reference, language_destroy) |