提交 21d2c92f 编写于 作者: B Behdad Esfahbod

Move code around

上级 448ea9bf
......@@ -106,20 +106,20 @@ typedef struct {
/* XXX make this thread-safe, somehow! */
struct hb_user_data_t {
hb_user_data_key_t *key;
void *data;
hb_destroy_func_t destroy;
struct hb_user_data_array_t {
inline bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
inline bool operator == (hb_user_data_t &other) const { return key == other.key; }
struct hb_user_data_item_t {
hb_user_data_key_t *key;
void *data;
hb_destroy_func_t destroy;
void finish (void) { if (destroy) destroy (data); }
};
inline bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
inline bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
struct hb_user_data_array_t {
void finish (void) { if (destroy) destroy (data); }
};
hb_set_t<hb_user_data_t> items;
hb_set_t<hb_user_data_item_t> items;
inline bool set (hb_user_data_key_t *key,
void * data,
......@@ -131,13 +131,13 @@ struct hb_user_data_array_t {
items.remove (key);
return true;
}
hb_user_data_t user_data = {key, data, destroy};
return items.insert (user_data);
hb_user_data_item_t item = {key, data, destroy};
return items.insert (item);
}
inline void *get (hb_user_data_key_t *key) {
hb_user_data_t *user_data = items.get (key);
return user_data ? user_data->data : NULL;
hb_user_data_item_t *item = items.get (key);
return item ? item->data : NULL;
}
void finish (void) { items.finish (); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册