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:
Julian Oes
2016-03-29 22:43:20 +02:00
committed by Lorenz Meier
parent 3981f06d42
commit 7ce297be59
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -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;
}
+2
View File
@@ -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