[object] Fix bug in get_user_data() implementation

This commit is contained in:
Behdad Esfahbod 2011-05-02 19:53:39 -04:00
parent db99589529
commit 1cd5969f25
1 changed files with 4 additions and 3 deletions

View File

@ -91,7 +91,8 @@ struct hb_user_data_array_t {
} }
inline void *get (hb_user_data_key_t *key) { inline void *get (hb_user_data_key_t *key) {
return map.get (key); hb_user_data_t *user_data = map.get (key);
return user_data ? user_data->data : NULL;
} }
void finish (void) { map.finish (); } void finish (void) { map.finish (); }
@ -177,7 +178,7 @@ static inline void hb_object_trace (const Type *obj, const char *function)
obj->header.trace (function); obj->header.trace (function);
} }
template <typename Type> template <typename Type>
static inline Type *hb_object_create () static inline Type *hb_object_create (void)
{ {
Type *obj = (Type *) hb_object_header_t::create (sizeof (Type)); Type *obj = (Type *) hb_object_header_t::create (sizeof (Type));
hb_object_trace (obj, HB_FUNC); hb_object_trace (obj, HB_FUNC);
@ -186,7 +187,7 @@ static inline Type *hb_object_create ()
template <typename Type> template <typename Type>
static inline bool hb_object_is_inert (const Type *obj) static inline bool hb_object_is_inert (const Type *obj)
{ {
return unlikely (obj->header.is_inert()); return unlikely (obj->header.is_inert ());
} }
template <typename Type> template <typename Type>
static inline Type *hb_object_reference (Type *obj) static inline Type *hb_object_reference (Type *obj)