From 9b6f6642ee252a9bedbe267fd85376fc9359c74f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 30 Jan 2024 15:29:55 -0500 Subject: update standard and safety checks --- src/string/memset_s.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/string/memset_s.c') diff --git a/src/string/memset_s.c b/src/string/memset_s.c index 2784a7c9..0708f338 100644 --- a/src/string/memset_s.c +++ b/src/string/memset_s.c @@ -1,21 +1,20 @@ -#if 0 - #include +#include "_safety.h" /** fill memory **/ errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n) { - __C_EXT(1, 201112L); - __ASSERT_NONNULL(s); + SIGNAL_SAFE(0); + ASSERT_NONNULL(s); unsigned char *_s = (unsigned char *)s; - int i = 0; + rsize_t i = 0; - while (i < n) { + while (i < n && i < smax) { _s[i] = (unsigned char)c; } - return s; + return 0; } /*** @@ -33,6 +32,3 @@ the value arg(c) (converted to an type(unsigned char)). /* CEXT1(201112) */ - - -#endif -- cgit v1.2.1