Shrink code
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 368789a..68c8711 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -29,6 +29,7 @@
#include "hb-private.hh"
#include "hb-mutex-private.hh"
+#include "hb-object-private.hh"
HB_BEGIN_DECLS
@@ -261,4 +262,29 @@
}
+/* hb_user_data_array_t */
+
+bool
+hb_user_data_array_t::set (hb_user_data_key_t *key,
+ void * data,
+ hb_destroy_func_t destroy)
+{
+ if (!key)
+ return false;
+ if (!data && !destroy) {
+ items.remove (key);
+ return true;
+ }
+ hb_user_data_item_t item = {key, data, destroy};
+ return !!items.insert (item);
+}
+
+void *
+hb_user_data_array_t::get (hb_user_data_key_t *key)
+{
+ hb_user_data_item_t *item = items.find (key);
+ return item ? item->data : NULL;
+}
+
+
HB_END_DECLS