2013-12-06 12:04:52 +01:00
|
|
|
/* $NetBSD: explicit_memset.c,v 1.3 2013/08/28 17:47:07 riastradh Exp $ */
|
2012-11-15 12:06:41 +01:00
|
|
|
|
|
|
|
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
2013-12-06 12:04:52 +01:00
|
|
|
#include "namespace.h"
|
2012-11-15 12:06:41 +01:00
|
|
|
#include <string.h>
|
2013-12-06 12:04:52 +01:00
|
|
|
#ifdef __weak_alias
|
|
|
|
__weak_alias(explicit_memset,_explicit_memset)
|
|
|
|
#endif
|
2012-11-15 12:06:41 +01:00
|
|
|
#define explicit_memset_impl __explicit_memset_impl
|
|
|
|
#else
|
|
|
|
#include <lib/libkern/libkern.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The use of a volatile pointer guarantees that the compiler
|
|
|
|
* will not optimise the call away.
|
|
|
|
*/
|
|
|
|
void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
void *
|
|
|
|
explicit_memset(void *b, int c, size_t len)
|
2012-11-15 12:06:41 +01:00
|
|
|
{
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
return (*explicit_memset_impl)(b, c, len);
|
2012-11-15 12:06:41 +01:00
|
|
|
}
|