private fork
Fork of GSwifiInterface by
Diff: GSwifi/CBuffer.h
- Revision:
- 19:d035412a7803
- Parent:
- 12:057089026a20
--- a/GSwifi/CBuffer.h Mon May 12 01:24:09 2014 +0000 +++ b/GSwifi/CBuffer.h Thu Jun 05 04:21:02 2014 +0000 @@ -22,11 +22,15 @@ template <class T> class CircBuffer { public: - CircBuffer(int length) { + CircBuffer(int length, void *addr = NULL) { write = 0; read = 0; size = length + 1; - buf = (T *)malloc(size * sizeof(T)); + if (addr) { + buf = (T *)addr; + } else { + buf = (T *)malloc(size * sizeof(T)); + } if (buf == NULL) error("Can't allocate memory"); };