diff options
| author | bernard.xiong <[email protected]> | 2011-11-08 04:06:12 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2011-11-08 04:06:12 +0000 |
| commit | e7eaf16bf490f19d26d3ac9b4ac9eaf1eea5bfd4 (patch) | |
| tree | a523dd09bbf295bae723e651591f3c6cf6679e93 /src/object.c | |
| parent | 04ab961b6f6ac0b995c21cac7b49624dea0a7555 (diff) | |
fixed object name copy bug; update AT91SAM7S64 branch.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1787 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/object.c')
| -rw-r--r-- | src/object.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/object.c b/src/object.c index feedc1def8..f4a45713d7 100644 --- a/src/object.c +++ b/src/object.c @@ -204,10 +204,7 @@ void rt_object_init(struct rt_object *object, enum rt_object_class_type type, co object->type = type | RT_Object_Class_Static; /* copy name */ - for (temp = 0; temp < RT_NAME_MAX; temp ++) - { - object->name[temp] = name[temp]; - } + rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); @@ -296,10 +293,7 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name) #endif /* copy name */ - for (temp = 0; temp < RT_NAME_MAX; temp ++) - { - object->name[temp] = name[temp]; - } + rt_strncpy(object->name, name, RT_NAME_MAX); RT_OBJECT_HOOK_CALL(rt_object_attach_hook, (object)); |
