diff options
| author | Bernard Xiong <[email protected]> | 2018-07-11 21:38:31 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-07-11 21:38:31 +0800 |
| commit | 44712ba2cfd113374986f7a63d7c48ec34c4a8da (patch) | |
| tree | 7b3b9c3ad9954bce86ae2fc80d5edc7498808185 /src/object.c | |
| parent | 5719a3db3aa1c151df8de35fdf9aff131582da94 (diff) | |
| parent | d645525a0b7a6e2f1113910a7a6c2fefd6cd388f (diff) | |
Merge pull request #1611 from TanekLiang/add-more-assert
add more assert for object check
Diffstat (limited to 'src/object.c')
| -rw-r--r-- | src/object.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/object.c b/src/object.c index 958161e320..b09af9ddee 100644 --- a/src/object.c +++ b/src/object.c @@ -291,6 +291,9 @@ void rt_object_detach(rt_object_t object) RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); + /* reset object type */ + object->type = 0; + /* lock interrupt */ temp = rt_hw_interrupt_disable(); @@ -378,6 +381,9 @@ void rt_object_delete(rt_object_t object) RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); + /* reset object type */ + object->type = 0; + /* lock interrupt */ temp = rt_hw_interrupt_disable(); @@ -413,6 +419,22 @@ rt_bool_t rt_object_is_systemobject(rt_object_t object) } /** + * This function will return the type of object without + * RT_Object_Class_Static flag. + * + * @param object the specified object to be get type. + * + * @return the type of object. + */ +rt_uint8_t rt_object_get_type(rt_object_t object) +{ + /* object check */ + RT_ASSERT(object != RT_NULL); + + return object->type & ~RT_Object_Class_Static; +} + +/** * This function will find specified name object from object * container. * |
