mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 06:13:35 +08:00
sdlog2: add logbuffer_reset to reset pointers
This allows resetting of the logbuffer without having to free and malloc again.
This commit is contained in:
@@ -156,3 +156,10 @@ void logbuffer_free(struct logbuffer_s *lb)
|
||||
perf_free(lb->perf_dropped);
|
||||
}
|
||||
}
|
||||
|
||||
void logbuffer_reset(struct logbuffer_s *lb)
|
||||
{
|
||||
// Keep the buffer but reset the pointers.
|
||||
lb->write_ptr = 0;
|
||||
lb->read_ptr = 0;
|
||||
}
|
||||
|
||||
@@ -69,4 +69,6 @@ void logbuffer_mark_read(struct logbuffer_s *lb, int n);
|
||||
|
||||
void logbuffer_free(struct logbuffer_s *lb);
|
||||
|
||||
void logbuffer_reset(struct logbuffer_s *lb);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user