summaryrefslogtreecommitdiff
path: root/spa/include
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-03-20 19:27:46 +0100
committerWim Taymans <wtaymans@redhat.com>2019-03-20 19:27:46 +0100
commit74cf412f47c22ce418c761d78510a84e63ebd9de (patch)
tree64e43cb610654256ab593e2c9507d99aff19fa83 /spa/include
parentc2cb74a1460fca81e3aa1c22e3031ecad75ea020 (diff)
utils: add debugable spa_memcpy
Diffstat (limited to 'spa/include')
-rw-r--r--spa/include/spa/utils/defs.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h
index 9226f48d..eb9b9917 100644
--- a/spa/include/spa/utils/defs.h
+++ b/spa/include/spa/utils/defs.h
@@ -239,6 +239,17 @@ struct spa_param_info {
strerror(_err); \
})
+#ifdef SPA_DEBUG_MEMCPY
+#define spa_memcpy(d,s,n) \
+({ \
+ fprintf(stderr, "%s:%u %s() memcpy(%p, %p, %zd)\n", \
+ __FILE__, __LINE__, __func__, (d), (s), (size_t)(n)); \
+ memcpy(d,s,n); \
+})
+#else
+#define spa_memcpy(d,s,n) memcpy(d,s,n)
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif