Skip to content

Commit 07e19eb

Browse files
committed
[libc][syscall] (second) Add detailed function comments for memory management functions
Signed-off-by: MaChengyang <3427742239@qq.com>
1 parent e789b92 commit 07e19eb

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

components/libc/compilers/armlibc/syscall_mem.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2014-08-03 bernard Add file header
9-
* 2021-11-13 Meco Man implement no-heap warning
10-
* 2025-11-1 MaChengyang Add detailed function comments
9+
* 2021-11-13 Meco Man implement no-heap warning
1110
*/
1211

1312
#include <rtthread.h>
@@ -29,20 +28,19 @@
2928
#endif /* __CC_ARM */
3029

3130
/**
32-
* @brief Allocate memory block
31+
* @brief Allocate memory block
3332
*
3433
* Allocates a block of size bytes of memory, returning a pointer to the
3534
* beginning of the block. The content of the newly allocated block of
3635
* memory is not initialized, remaining with indeterminate values.
3736
*
38-
* @param n the size of the memory block, in bytes.
37+
* @param[in] n the size of the memory block, in bytes.
3938
*
4039
* @return On success, a pointer to the memory block allocated by the function.
4140
* If the system is configured without heap (RT_USING_HEAP is not defined),
4241
* the function will assert and return RT_NULL.
4342
*
4443
* @note The returned pointer is always suitably aligned for any built-in type.
45-
* @see rt_malloc
4644
*/
4745
void *malloc(size_t n)
4846
{
@@ -56,7 +54,7 @@ void *malloc(size_t n)
5654
RTM_EXPORT(malloc);
5755

5856
/**
59-
* @brief Reallocate memory block
57+
* @brief Reallocate memory block
6058
*
6159
* Changes the size of the memory block pointed to by rmem.
6260
* The function may move the memory block to a new location
@@ -66,18 +64,16 @@ RTM_EXPORT(malloc);
6664
* moved to a new location. If the new size is larger,
6765
* the value of the newly allocated portion is indeterminate.
6866
*
69-
* @param rmem pointer to a memory block previously allocated with
67+
* @param[in,out] rmem pointer to a memory block previously allocated with
7068
* malloc, calloc or realloc to be reallocated.
7169
* If this is RT_NULL, a new block is allocated and
7270
* a pointer to it is returned by the function.
73-
* @param newsize new size for the memory block, in bytes.
71+
* @param[in] newsize new size for the memory block, in bytes.
7472
*
7573
* @return A pointer to the reallocated memory block, which may be either
7674
* the same as the rmem pointer or a new location.
7775
* If the system is configured without heap (RT_USING_HEAP is not defined),
7876
* the function will assert and return RT_NULL.
79-
*
80-
* @see rt_realloc
8177
*/
8278
void *realloc(void *rmem, size_t newsize)
8379
{
@@ -91,21 +87,19 @@ void *realloc(void *rmem, size_t newsize)
9187
RTM_EXPORT(realloc);
9288

9389
/**
94-
* @brief Allocate and zero-initialize array
90+
* @brief Allocate and zero-initialize array
9591
*
9692
* Allocates a block of memory for an array of nelem elements, each of them
9793
* elsize bytes long, and initializes all its bits to zero.
9894
* The effective result is the allocation of a zero-initialized memory block
9995
* of (nelem*elsize) bytes.
10096
*
101-
* @param nelem number of elements to allocate.
102-
* @param elsize size of each element.
97+
* @param[in] nelem number of elements to allocate.
98+
* @param[in] elsize size of each element.
10399
*
104100
* @return On success, a pointer to the memory block allocated by the function.
105101
* If the system is configured without heap (RT_USING_HEAP is not defined),
106102
* the function will assert and return RT_NULL.
107-
*
108-
* @see rt_calloc
109103
*/
110104
void *calloc(size_t nelem, size_t elsize)
111105
{
@@ -119,18 +113,17 @@ void *calloc(size_t nelem, size_t elsize)
119113
RTM_EXPORT(calloc);
120114

121115
/**
122-
* @brief Deallocate memory block
116+
* @brief Deallocate memory block
123117
*
124118
* A block of memory previously allocated by a call to malloc, calloc or realloc
125119
* is deallocated, making it available again for further allocations.
126120
*
127-
* @param rmem pointer to a memory block previously allocated with malloc,
121+
* @param[in] rmem pointer to a memory block previously allocated with malloc,
128122
* calloc or realloc to be deallocated. If a null pointer is
129123
* passed as argument, no action occurs.
130124
*
131125
* @note If the system is configured without heap (RT_USING_HEAP is not defined),
132126
* the function will assert.
133-
* @see rt_free
134127
*/
135128
void free(void *rmem)
136129
{

0 commit comments

Comments
 (0)