Skip to content

Commit 21d3225

Browse files
committed
kernel: heap: rename resereved 'rewind'
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 5812145 commit 21d3225

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/os/heap.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ void *sys_heap_alloc(struct sys_heap *heap, size_t bytes)
246246
void *sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes)
247247
{
248248
struct z_heap *h = heap->heap;
249-
size_t gap, rewind;
249+
size_t gap, rew;
250250

251251
/*
252252
* Split align and rewind values (if any).
@@ -255,15 +255,15 @@ void *sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes)
255255
* So if e.g. align = 0x28 (32 | 8) this means we align to a 32-byte
256256
* boundary and then rewind 8 bytes.
257257
*/
258-
rewind = align & -align;
259-
if (align != rewind) {
260-
align -= rewind;
261-
gap = MIN(rewind, chunk_header_bytes(h));
258+
rew = align & -align;
259+
if (align != rew) {
260+
align -= rew;
261+
gap = MIN(rew, chunk_header_bytes(h));
262262
} else {
263263
if (align <= chunk_header_bytes(h)) {
264264
return sys_heap_alloc(heap, bytes);
265265
}
266-
rewind = 0;
266+
rew = 0;
267267
gap = chunk_header_bytes(h);
268268
}
269269
__ASSERT((align & (align - 1)) == 0, "align must be a power of 2");
@@ -286,7 +286,7 @@ void *sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes)
286286
uint8_t *mem = chunk_mem(h, c0);
287287

288288
/* Align allocated memory */
289-
mem = (uint8_t *) ROUND_UP(mem + rewind, align) - rewind;
289+
mem = (uint8_t *) ROUND_UP(mem + rew, align) - rew;
290290
chunk_unit_t *end = (chunk_unit_t *) ROUND_UP(mem + bytes, CHUNK_UNIT);
291291

292292
/* Get corresponding chunks */

0 commit comments

Comments
 (0)