Merge pull request #4562 from mysterywolf/ringblk

[ringblk_buf.c] NULL -> RT_NULL
This commit is contained in:
Bernard Xiong 2021-04-02 18:25:38 +08:00 committed by GitHub
commit 5b4ed5f4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 21 deletions

View File

@ -50,26 +50,26 @@ RTM_EXPORT(rt_rbb_init);
* @param buf_size buffer size
* @param blk_max_num max block number
*
* @return != NULL: ring block buffer object
* NULL: create failed
* @return != RT_NULL: ring block buffer object
* RT_NULL: create failed
*/
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num)
{
rt_rbb_t rbb = NULL;
rt_rbb_t rbb = RT_NULL;
rt_uint8_t *buf;
rt_rbb_blk_t blk_set;
rbb = (rt_rbb_t)rt_malloc(sizeof(struct rt_rbb));
if (!rbb)
{
return NULL;
return RT_NULL;
}
buf = (rt_uint8_t *)rt_malloc(buf_size);
if (!buf)
{
rt_free(rbb);
return NULL;
return RT_NULL;
}
blk_set = (rt_rbb_blk_t)rt_malloc(sizeof(struct rt_rbb_blk) * blk_max_num);
@ -77,7 +77,7 @@ rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num)
{
rt_free(buf);
rt_free(rbb);
return NULL;
return RT_NULL;
}
rt_rbb_init(rbb, buf, buf_size, blk_set, blk_max_num);
@ -116,7 +116,7 @@ static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
}
}
return NULL;
return RT_NULL;
}
/**
@ -127,14 +127,14 @@ static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
*
* @note When your application need align access, please make the blk_szie is aligned.
*
* @return != NULL: allocated block
* NULL: allocate failed
* @return != RT_NULL: allocated block
* RT_NULL: allocate failed
*/
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
{
rt_base_t level;
rt_size_t empty1 = 0, empty2 = 0;
rt_rbb_blk_t head, tail, new_rbb = NULL;
rt_rbb_blk_t head, tail, new_rbb = RT_NULL;
RT_ASSERT(rbb);
RT_ASSERT(blk_size < (1L << 24));
@ -178,7 +178,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
new_rbb = NULL;
new_rbb = RT_NULL;
}
}
else
@ -202,7 +202,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
new_rbb = NULL;
new_rbb = RT_NULL;
}
}
}
@ -217,7 +217,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
}
else
{
new_rbb = NULL;
new_rbb = RT_NULL;
}
rt_hw_interrupt_enable(level);
@ -245,13 +245,13 @@ RTM_EXPORT(rt_rbb_blk_put);
*
* @param rbb ring block buffer object
*
* @return != NULL: block
* NULL: get failed
* @return != RT_NULL: block
* RT_NULL: get failed
*/
rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
{
rt_base_t level;
rt_rbb_blk_t block = NULL;
rt_rbb_blk_t block = RT_NULL;
rt_slist_t *node;
RT_ASSERT(rbb);
@ -271,7 +271,7 @@ rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
}
}
/* not found */
block = NULL;
block = RT_NULL;
__exit:
@ -364,7 +364,7 @@ rt_size_t rt_rbb_blk_queue_get(rt_rbb_t rbb, rt_size_t queue_data_len, rt_rbb_bl
rt_base_t level;
rt_size_t data_total_size = 0;
rt_slist_t *node;
rt_rbb_blk_t last_block = NULL, block;
rt_rbb_blk_t last_block = RT_NULL, block;
RT_ASSERT(rbb);
RT_ASSERT(blk_queue);
@ -388,7 +388,7 @@ rt_size_t rt_rbb_blk_queue_get(rt_rbb_t rbb, rt_size_t queue_data_len, rt_rbb_bl
else
{
/* the first block must be put status */
last_block = NULL;
last_block = RT_NULL;
continue;
}
}
@ -493,7 +493,7 @@ rt_size_t rt_rbb_next_blk_queue_len(rt_rbb_t rbb)
rt_base_t level;
rt_size_t data_len = 0;
rt_slist_t *node;
rt_rbb_blk_t last_block = NULL, block;
rt_rbb_blk_t last_block = RT_NULL, block;
RT_ASSERT(rbb);
@ -510,7 +510,7 @@ rt_size_t rt_rbb_next_blk_queue_len(rt_rbb_t rbb)
if (last_block->status != RT_RBB_BLK_PUT)
{
/* the first block must be put status */
last_block = NULL;
last_block = RT_NULL;
continue;
}
}