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