Util: RingFIFO should be able to advance without memcpy
Jeffrey Pfau jeffrey@endrift.com
Sat, 06 Aug 2016 22:05:46 -0700
1 files changed,
6 insertions(+),
2 deletions(-)
jump to
M
src/util/ring-fifo.c
→
src/util/ring-fifo.c
@@ -43,7 +43,9 @@ }
if (remaining <= length) { return 0; } - memcpy(data, value, length); + if (value) { + memcpy(data, value, length); + } buffer->writePtr = (void*) ((intptr_t) data + length); return length; }@@ -63,7 +65,9 @@ }
if (remaining <= length) { return 0; } - memcpy(output, data, length); + if (output) { + memcpy(output, data, length); + } buffer->readPtr = (void*) ((intptr_t) data + length); return length; }