Match the implementation of the inline function from libkern.h.

This commit is contained in:
David E. O'Brien 2008-07-14 21:36:02 +00:00
parent 7972c979c5
commit 1989184838
2 changed files with 17 additions and 5 deletions

View File

@ -23,18 +23,22 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/types.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
void *memset(void *, int, size_t); #define LIBKERN_INLINE
#include <sys/types.h>
#include <sys/libkern.h>
void * void *
memset(void *b, int c, size_t len) memset(void *b, int c, size_t len)
{ {
char *bb; char *bb;
for (bb = (char *)b; len--; ) if (c == 0)
*bb++ = c; bzero(b, len);
else
for (bb = (char *)b; len--; )
*bb++ = c;
return (b); return (b);
} }

View File

@ -39,6 +39,11 @@
#include <sys/systm.h> #include <sys/systm.h>
#endif #endif
#ifndef LIBKERN_INLINE
#define LIBKERN_INLINE static __inline
#define LIBKERN_BODY
#endif
/* BCD conversions. */ /* BCD conversions. */
extern u_char const bcd2bin_data[]; extern u_char const bcd2bin_data[];
extern u_char const bin2bcd_data[]; extern u_char const bin2bcd_data[];
@ -140,7 +145,9 @@ memcmp(const void *b1, const void *b2, size_t len)
return (bcmp(b1, b2, len)); return (bcmp(b1, b2, len));
} }
static __inline void * LIBKERN_INLINE void *memset(void *, int, size_t);
#ifdef LIBKERN_BODY
LIBKERN_INLINE void *
memset(void *b, int c, size_t len) memset(void *b, int c, size_t len)
{ {
char *bb; char *bb;
@ -152,6 +159,7 @@ memset(void *b, int c, size_t len)
*bb++ = c; *bb++ = c;
return (b); return (b);
} }
#endif
static __inline char * static __inline char *
strchr(const char *p, int ch) strchr(const char *p, int ch)