summaryrefslogtreecommitdiff
path: root/src/string/memset_s.c
blob: 661b8d8b41aea8e8e6c4119d626e90ec0123125f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <string.h>

/** fill memory **/
errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
{
	__C_EXT(1, 201112L);
	__ASSERT_NONNULL(s);

	unsigned char *_s = (unsigned char *)s;
	int i = 0;

	while (i < n) {
		_s[i] = (unsigned char)c;
	}

	return s;
}

/***
The fn(memset) function fills the first arg(n) bytes of memory at arg(s) with
the value arg(c) (converted to an type(unsigned char)).
***/

/* UNSPECIFIED: - */
/* UNDEFINED: - */
/* IMPLEMENTATION: - */
/* LOCALE: - */

/* RETURN: the value of arg(s) */

/*
CEXT1(201112)
*/