diff options
| author | Ian Moffett <ian@osmora.org> | 2025-12-22 20:01:45 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-12-22 20:01:45 -0500 |
| commit | 6c49129750fc2d8778d30f623b0a1ea22fa79328 (patch) | |
| tree | 086194ac6a4cb6b68885148f9cceae57c317dbf1 /usr/sdk/common/string | |
| parent | 0ca11cce7f3660a4b92441c39c30b24866a210c6 (diff) | |
usr: sdk: Add memset() function
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr/sdk/common/string')
| -rw-r--r-- | usr/sdk/common/string/memset.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/sdk/common/string/memset.c b/usr/sdk/common/string/memset.c new file mode 100644 index 0000000..ac0b4a2 --- /dev/null +++ b/usr/sdk/common/string/memset.c @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025, Ian Moffett. + * Provided under the BSD-3 clause. + */ + +#include <sdk/string.h> + +void * +memset(void *s, int c, USIZE n) +{ + if (s == NULL) { + return NULL; + } + + for (USIZE i = 0; i < n; ++i) { + ((BYTE *)s)[i] = c; + } + + return s; +} |
