Skip to content

Commit

Permalink
Merge pull request #711 from PX4/sdlog2_opt
Browse files Browse the repository at this point in the history
sdlog2 optimization
  • Loading branch information
LorenzMeier committed Mar 12, 2014
2 parents b6a087e + 1a795f2 commit 0cce688
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 525 deletions.
3 changes: 2 additions & 1 deletion src/modules/sdlog2/logbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ bool logbuffer_write(struct logbuffer_s *lb, void *ptr, int size)
// bytes available to write
int available = lb->read_ptr - lb->write_ptr - 1;

if (available < 0)
if (available < 0) {
available += lb->size;
}

if (size > available) {
// buffer overflow
Expand Down
Loading

0 comments on commit 0cce688

Please sign in to comment.