summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/byte_zzero.c35
-rw-r--r--src/libstddjb/openb_read.c10
2 files changed, 45 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
diff --git a/src/libstddjb/openb_read.c b/src/libstddjb/openb_read.c
new file mode 100644
index 0000000..19ec073
--- /dev/null
+++ b/src/libstddjb/openb_read.c
@@ -0,0 +1,10 @@
+/* ISC license. */
+
+#include <skalibs/nonposix.h>
+#include <fcntl.h>
+#include <skalibs/djbunix.h>
+
+int openb_read (char const *fn)
+{
+ return open2(fn, O_RDONLY) ;
+}