MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_object_get_name

Function rt_object_get_name

src/object.c:745–758  ·  view source on GitHub ↗

* @brief This function will return the name of the specified object container * * @param object the specified object to be get name * @param name buffer to store the object name string * @param name_size maximum size of the buffer to store object name * * @return -RT_EINVAL if any parameter is invalid or RT_EOK if the operation is successfully executed * * @note this function shal

Source from the content-addressed store, hash-verified

743 * @note this function shall not be invoked in interrupt status
744 */
745rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size)
746{
747 rt_err_t result = -RT_EINVAL;
748 if ((object != RT_NULL) && (name != RT_NULL) && (name_size != 0U))
749 {
750 const char *obj_name = object->name;
751 rt_strncpy(name, obj_name, (rt_size_t)name_size);
752 /* Ensure null-termination */
753 name[name_size - 1] = '\0';
754 result = RT_EOK;
755 }
756
757 return result;
758}
759
760#ifdef RT_USING_HEAP
761/**

Callers 2

rt_thread_get_nameFunction · 0.85

Calls 1

rt_strncpyFunction · 0.85

Tested by 1