diff options
Diffstat (limited to 'src/string/memset.c')
-rw-r--r-- | src/string/memset.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/string/memset.c b/src/string/memset.c new file mode 100644 index 00000000..1f3d14ff --- /dev/null +++ b/src/string/memset.c @@ -0,0 +1,28 @@ +#include <string.h> +#include "nonstd/assert.h" + +/** fill memory **/ +void * memset(void *s, int c, size_t n) +{ + unsigned char *p = (unsigned char *)s; + size_t i = 0; + + ASSERT_NONNULL(s); + + for (i = 0; i < n; i++) { + p[i] = (unsigned char)c; + } + + /* + RETURN_ALWAYS(ARGUMENT(s)); + */ + return s; +} + +/*** +fills the first ARGUMENT(n) bytes of memory at ARGUMENT(s) with +the value ARGUMENT(c) (converted to an TYPE(unsigned char)). +***/ +/* +STDC(1) +*/ |