mm/circbuf: fix minor issue about update buffer head
update head pointer with skip before write buffer. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
b178ce4da9
commit
81825bc003
|
@ -526,6 +526,7 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
|
|||
overwrite = bytes - space + skip;
|
||||
}
|
||||
|
||||
circ->head += skip;
|
||||
off = circ->head % circ->size;
|
||||
space = circ->size - off;
|
||||
if (bytes < space)
|
||||
|
@ -535,7 +536,7 @@ ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
|
|||
|
||||
memcpy((FAR char *)circ->base + off, src, space);
|
||||
memcpy(circ->base, (FAR char *)src + space, bytes - space);
|
||||
circ->head += bytes + skip;
|
||||
circ->head += bytes;
|
||||
circ->tail += overwrite;
|
||||
|
||||
return overwrite;
|
||||
|
|
Loading…
Reference in New Issue