summaryrefslogtreecommitdiff
path: root/src/string
diff options
context:
space:
mode:
Diffstat (limited to 'src/string')
-rw-r--r--src/string/explicit_bzero.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string/explicit_bzero.c b/src/string/explicit_bzero.c
new file mode 100644
index 00000000..3d270040
--- /dev/null
+++ b/src/string/explicit_bzero.c
@@ -0,0 +1,8 @@
+#define _BSD_SOURCE
+#include <string.h>
+
+void explicit_bzero(void *d, size_t n)
+{
+ memset(d, 0, n);
+ __asm__ __volatile__ ("" : : "r"(d) : "memory");
+}