summaryrefslogtreecommitdiff
path: root/components/drivers/src
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-08-19 10:50:20 +0800
committerGrissiom <[email protected]>2013-08-19 14:12:35 +0800
commit981d929b562610328309ee4e01d66727f5e6896e (patch)
treec359aa49f1e68671f7c871074a73e54605f6467d /components/drivers/src
parent6f75988cee4c0e7bfd77211c56c40681cbc4710e (diff)
ringbuffer: fix the ambiguous name
RT_RINGBUFFER_SIZE could mean "the size of the whole buffer", "the size of the empty space" or "the size of the data". Moreover, it's never a micro anymore. Change it to rt_ringbuffer_data_len before it's too late. Also, RT_RINGBUFFER_EMPTY is changed to rt_ringbuffer_space_len.
Diffstat (limited to 'components/drivers/src')
-rw-r--r--components/drivers/src/ringbuffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c
index 8e7e8c7895..ecc2587042 100644
--- a/components/drivers/src/ringbuffer.c
+++ b/components/drivers/src/ringbuffer.c
@@ -53,7 +53,7 @@ rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb,
RT_ASSERT(rb != RT_NULL);
/* whether has enough space */
- size = RT_RINGBUFFER_EMPTY(rb);
+ size = rt_ringbuffer_space_len(rb);
/* no space */
if (size == 0)
@@ -100,7 +100,7 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
RT_ASSERT(rb != RT_NULL);
/* whether has enough data */
- size = RT_RINGBUFFER_SIZE(rb);
+ size = rt_ringbuffer_data_len(rb);
/* no data */
if (size == 0)
@@ -143,7 +143,7 @@ rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch)
RT_ASSERT(rb != RT_NULL);
/* whether has enough space */
- if (!RT_RINGBUFFER_EMPTY(rb))
+ if (!rt_ringbuffer_space_len(rb))
return 0;
rb->buffer_ptr[rb->write_index] = ch;
@@ -171,7 +171,7 @@ rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch)
RT_ASSERT(rb != RT_NULL);
/* ringbuffer is empty */
- if (!RT_RINGBUFFER_SIZE(rb))
+ if (!rt_ringbuffer_data_len(rb))
return 0;
/* put character */