xref: /netbsd-src/common/lib/libc/string/explicit_memset.c (revision 7788a0781fe6ff2cce37368b4578a7ade0850cb1)
1 /* $NetBSD: explicit_memset.c,v 1.1 2013/06/24 04:21:19 riastradh Exp $ */
2 
3 #if !defined(_KERNEL) && !defined(_STANDALONE)
4 #include <string.h>
5 #define explicit_memset __explicit_memset
6 #define explicit_memset_impl __explicit_memset_impl
7 #else
8 #include <lib/libkern/libkern.h>
9 #endif
10 
11 /*
12  * The use of a volatile pointer guarantees that the compiler
13  * will not optimise the call away.
14  */
15 void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
16 
17 void
18 explicit_memset(void *b, int c, size_t len)
19 {
20 
21 	(*explicit_memset_impl)(b, c, len);
22 }
23