1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180514
2 changed files with 17 additions and 5 deletions

View File

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

View File

@ -39,6 +39,11 @@
#include <sys/systm.h>
#endif
#ifndef LIBKERN_INLINE
#define LIBKERN_INLINE static __inline
#define LIBKERN_BODY
#endif
/* BCD conversions. */
extern u_char const bcd2bin_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));
}
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)
{
char *bb;
@ -152,6 +159,7 @@ memset(void *b, int c, size_t len)
*bb++ = c;
return (b);
}
#endif
static __inline char *
strchr(const char *p, int ch)