aboutsummaryrefslogtreecommitdiff
path: root/src/extlib.h
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2024-07-11 02:56:56 +0200
committeraxtloss <axtlos@getcryst.al>2024-07-11 02:56:56 +0200
commit3e85fcb0270c9224ab95dac02c737e6676974c8e (patch)
tree2ec96323ef26f9ec1fee8ac6a0b718700e909eda /src/extlib.h
parente8f6d6c71b45062cc7ec4dcadcecba44af39a15d (diff)
downloadextlib-3e85fcb0270c9224ab95dac02c737e6676974c8e.tar.gz
extlib-3e85fcb0270c9224ab95dac02c737e6676974c8e.tar.bz2
Implement memset_s and improve free_secure
Diffstat (limited to 'src/extlib.h')
-rw-r--r--src/extlib.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/extlib.h b/src/extlib.h
index 87948f5..fc7a3d2 100644
--- a/src/extlib.h
+++ b/src/extlib.h
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdint.h>
#ifdef USE_SECURE_MEM
#define free(x) error - use free_secure
@@ -32,6 +33,25 @@ void free_secure (void **__ptr, size_t ptrlen);
void *malloc_secure (size_t len);
#endif
+#if (__STDC_WANT_LIB_EXT1__ == 1)
+#define RSIZE_MAX SIZE_MAX
+typedef int errno_t;
+typedef size_t rsize_t;
+
+typedef void (*constraint_handler_t) (const char *__restrict, void *__restrict, errno_t);
+/// Copy the value of c (converted to an unsigned char) into each of the first n
+/// characters of the object pointed to by s.
+/// Conforms to ISO/IEC 9899:2011 K.3.7.4.1
+errno_t memset_s (void *s, rsize_t max, int c, rsize_t n);
+
+constraint_handler_t set_constraint_handler_s (constraint_handler_t handler);
+void throw_constraint_handler_s (const char *restrict msg, errno_t error);
+_Noreturn void abort_handler_s (const char * __restrict, void * __restrict,
+ errno_t);
+void ignore_handler_s (const char *__restrict, void *__restrict, errno_t);
+#endif
+
+
/// Copy the data of one filestream to another */
void fcopy(FILE *f1, FILE *f2);