commit b5302fee81f0b1c46520c96ec7fa7b2d7e2289f2
Author: Alex Mayfield <alexmax2742@gmail.com>
AuthorDate: Mon Feb 13 00:52:13 2017 -0500
Commit: Alex Mayfield <alexmax2742@gmail.com>
CommitDate: Mon Feb 13 00:52:13 2017 -0500
Missing header, tidy up code
---
midiproc/buffer.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/midiproc/buffer.c b/midiproc/buffer.c
index 1e9d34da..1464b999 100644
--- a/midiproc/buffer.c
+++ b/midiproc/buffer.c
@@ -17,6 +17,8 @@
#include "buffer.h"
+#include <stdlib.h>
+
//
// Create a new buffer.
//
@@ -33,7 +35,7 @@ buffer_t *NewBuffer()
//
// Free a buffer.
//
-void DeleteBuffer(buffer_t* buf)
+void DeleteBuffer(buffer_t *buf)
{
free(buf);
}
@@ -54,6 +56,7 @@ boolean Buffer_Push(buffer_t *buf, const void *data, int len)
{
if (len <= 0)
{
+ // Do nothing, successfully.
return true;
}
@@ -90,12 +93,14 @@ void Buffer_Shift(buffer_t *buf, int len)
{
if (len <= 0)
{
+ // Do nothing.
return;
}
ptrdiff_t max_shift = buf->data_end - buf->data;
if (len >= max_shift)
{
+ // If the operation would clear the buffer, just zero everything.
Buffer_Clear(buf);
}
else