Skip to content

Commit 5812145

Browse files
committed
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 <[email protected]>
1 parent 669f7f7 commit 5812145

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/os/ring_buffer.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ static uint32_t mod(struct ring_buf *buf, uint32_t val)
4141
*/
4242
static void item_indexes_rewind(struct ring_buf *buf)
4343
{
44-
uint32_t rewind;
44+
uint32_t rew;
4545
uint32_t threshold = ring_buf_get_rewind_threshold();
4646

4747
if (buf->head < threshold) {
4848
return;
4949
}
5050

51-
rewind = buf->size * (threshold / buf->size);
51+
rew = buf->size * (threshold / buf->size);
5252

5353
k_spinlock_key_t key = k_spin_lock(&buf->lock);
5454

55-
buf->tail -= rewind;
56-
buf->head -= rewind;
55+
buf->tail -= rew;
56+
buf->head -= rew;
5757
k_spin_unlock(&buf->lock, key);
5858
}
5959

@@ -63,22 +63,22 @@ static void item_indexes_rewind(struct ring_buf *buf)
6363
*/
6464
static void byte_indexes_rewind(struct ring_buf *buf)
6565
{
66-
uint32_t rewind;
66+
uint32_t rew;
6767
uint32_t threshold = ring_buf_get_rewind_threshold();
6868

6969
/* Checking head since it is the smallest index. */
7070
if (buf->head < threshold) {
7171
return;
7272
}
7373

74-
rewind = buf->size * (threshold / buf->size);
74+
rew = buf->size * (threshold / buf->size);
7575

7676
k_spinlock_key_t key = k_spin_lock(&buf->lock);
7777

78-
buf->tail -= rewind;
79-
buf->head -= rewind;
80-
buf->misc.byte_mode.tmp_head -= rewind;
81-
buf->misc.byte_mode.tmp_tail -= rewind;
78+
buf->tail -= rew;
79+
buf->head -= rew;
80+
buf->misc.byte_mode.tmp_head -= rew;
81+
buf->misc.byte_mode.tmp_tail -= rew;
8282
k_spin_unlock(&buf->lock, key);
8383
}
8484

0 commit comments

Comments
 (0)