xref: /minix3/common/lib/libc/string/explicit_memset.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 /* $NetBSD: explicit_memset.c,v 1.4 2014/06/24 16:39:39 drochner Exp $ */
2 
3 /*
4  * Written by Matthias Drochner <drochner@NetBSD.org>.
5  * Public domain.
6  */
7 
8 #if !defined(_KERNEL) && !defined(_STANDALONE)
9 #include "namespace.h"
10 #include <string.h>
11 #ifdef __weak_alias
12 __weak_alias(explicit_memset,_explicit_memset)
13 #endif
14 #define explicit_memset_impl __explicit_memset_impl
15 #else
16 #include <lib/libkern/libkern.h>
17 #endif
18 
19 /*
20  * The use of a volatile pointer guarantees that the compiler
21  * will not optimise the call away.
22  */
23 void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
24 
25 void *
explicit_memset(void * b,int c,size_t len)26 explicit_memset(void *b, int c, size_t len)
27 {
28 
29 	return (*explicit_memset_impl)(b, c, len);
30 }
31