summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_zzero.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/byte_zzero.c')
-rw-r--r--src/libstddjb/byte_zzero.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libstddjb/byte_zzero.c b/src/libstddjb/byte_zzero.c
new file mode 100644
index 0000000..99a5e3a
--- /dev/null
+++ b/src/libstddjb/byte_zzero.c
@@ -0,0 +1,35 @@
+/* ISC license. */
+
+#include <skalibs/sysdeps.h>
+
+#ifdef SKALIBS_HASEXPLICIT_BZERO
+
+#include <skalibs/nonposix.h>
+#include <string.h>
+#include <strings.h>
+#include <skalibs/bytestr.h>
+
+void byte_zzero (char *s, size_t n)
+{
+ explicit_bzero(s, n) ;
+}
+
+#else
+
+#include <string.h>
+#include <skalibs/gccattributes.h>
+#include <skalibs/bytestr.h>
+
+void _byte_zzero_hook (char *, size_t) gccattr_weak ;
+
+gccattr_weak void _byte_zzero_hook (char *s, size_t n)
+{
+}
+
+void byte_zzero (char *s, size_t n)
+{
+ memset(s, 0, n) ;
+ _byte_zzero_hook(s, n) ;
+}
+
+#endif