explicit_memset.c revision 1.4
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 */ 23void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset; 24 25void * 26explicit_memset(void *b, int c, size_t len) 27{ 28 29 return (*explicit_memset_impl)(b, c, len); 30} 31