ring_buffer: rename resereved 'rewind' symbol

This symbol is reserved and usage of reserved symbols violates the
coding guidelines. (MISRA 21.2)

NAME
       fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream

SYNOPSIS
       #include <stdio.h>

       void rewind(FILE *stream);

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-03-22 07:56:02 -04:00
parent 669f7f74b8
commit 581214524a

View file

@ -41,19 +41,19 @@ static uint32_t mod(struct ring_buf *buf, uint32_t val)
*/
static void item_indexes_rewind(struct ring_buf *buf)
{
uint32_t rewind;
uint32_t rew;
uint32_t threshold = ring_buf_get_rewind_threshold();
if (buf->head < threshold) {
return;
}
rewind = buf->size * (threshold / buf->size);
rew = buf->size * (threshold / buf->size);
k_spinlock_key_t key = k_spin_lock(&buf->lock);
buf->tail -= rewind;
buf->head -= rewind;
buf->tail -= rew;
buf->head -= rew;
k_spin_unlock(&buf->lock, key);
}
@ -63,7 +63,7 @@ static void item_indexes_rewind(struct ring_buf *buf)
*/
static void byte_indexes_rewind(struct ring_buf *buf)
{
uint32_t rewind;
uint32_t rew;
uint32_t threshold = ring_buf_get_rewind_threshold();
/* Checking head since it is the smallest index. */
@ -71,14 +71,14 @@ static void byte_indexes_rewind(struct ring_buf *buf)
return;
}
rewind = buf->size * (threshold / buf->size);
rew = buf->size * (threshold / buf->size);
k_spinlock_key_t key = k_spin_lock(&buf->lock);
buf->tail -= rewind;
buf->head -= rewind;
buf->misc.byte_mode.tmp_head -= rewind;
buf->misc.byte_mode.tmp_tail -= rewind;
buf->tail -= rew;
buf->head -= rew;
buf->misc.byte_mode.tmp_head -= rew;
buf->misc.byte_mode.tmp_tail -= rew;
k_spin_unlock(&buf->lock, key);
}