aboutsummaryrefslogtreecommitdiffstats
path: root/src/Buffer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-01-23 10:18:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-01-23 10:51:26 +0100
commite12c679b8cc8a263507c556cb24819dc0d5559b9 (patch)
tree8f2cd06710d15ca64a4a86c1ce52bc975ec3f2b0 /src/Buffer.cpp
parentd82422fbb3d9d34a0566197245376548ce3ef14e (diff)
parent94c1f63b6fd07d74f3325274dd19fd6beaf53965 (diff)
downloaddabmod-e12c679b8cc8a263507c556cb24819dc0d5559b9.tar.gz
dabmod-e12c679b8cc8a263507c556cb24819dc0d5559b9.tar.bz2
dabmod-e12c679b8cc8a263507c556cb24819dc0d5559b9.zip
Merge raspine's ZeroMQ RC and UHD staticdelay
Merge raspine/master pull request, fix indentation, code style, and two minor conflicts in: doc/example.ini src/DabMod.cpp
Diffstat (limited to 'src/Buffer.cpp')
-rw-r--r--src/Buffer.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 7cbbe57..aa0ef4c 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#ifdef HAVE_DECL__MM_MALLOC
+#if HAVE_DECL__MM_MALLOC
# include <mm_malloc.h>
#else
# define memalign(a, b) malloc(b)
@@ -73,8 +73,10 @@ void Buffer::setLength(size_t len)
/* Align to 32-byte boundary for AVX. */
data = memalign(32, len);
- memcpy(data, tmp, this->len);
- free(tmp);
+ if (tmp != NULL) {
+ memcpy(data, tmp, this->len);
+ free(tmp);
+ }
size = len;
}
this->len = len;
@@ -97,14 +99,3 @@ void Buffer::appendData(const void *data, size_t len)
}
}
-
-size_t Buffer::getLength()
-{
- return len;
-}
-
-
-void *Buffer::getData()
-{
- return data;
-}