use an empty writebuf rather than a NULL one

This commit is contained in:
Matt Johnston
2013-03-20 22:31:07 +08:00
parent f7b1222073
commit 804a1e69f2
2 changed files with 10 additions and 13 deletions

View File

@@ -37,7 +37,9 @@ circbuffer * cbuf_new(unsigned int size) {
}
cbuf = (circbuffer*)m_malloc(sizeof(circbuffer));
cbuf->data = (unsigned char*)m_malloc(size);
if (size > 0) {
cbuf->data = (unsigned char*)m_malloc(size);
}
cbuf->used = 0;
cbuf->readpos = 0;
cbuf->writepos = 0;