Bite the bullet and provde memcmp() and memset(), this will be cheaper

than all the copy&paste versions we already have :-(
This commit is contained in:
phk 2000-09-02 13:34:52 +00:00
parent cbb2eff275
commit 5b79681c70
3 changed files with 20 additions and 25 deletions

View File

@ -220,19 +220,3 @@ int awi_wep_setalgo __P((struct awi_softc *, int));
int awi_wep_setkey __P((struct awi_softc *, int, unsigned char *, int));
int awi_wep_getkey __P((struct awi_softc *, int, unsigned char *, int *));
struct mbuf *awi_wep_encrypt __P((struct awi_softc *, struct mbuf *, int));
#ifdef __FreeBSD__
/* Provide mem* for compat with NetBSD to fix LINT */
static __inline int
memcmp(const void *b1, const void *b2, size_t len)
{
return (bcmp(b1, b2, len));
}
static __inline void *
memset(void *b, int c, size_t len)
{
bzero(b, len);
return (b);
}
#endif

View File

@ -85,4 +85,24 @@ size_t strlen __P((const char *));
int strncmp __P((const char *, const char *, size_t));
char *strncpy __P((char *, const char *, size_t));
static __inline int
memcmp(const void *b1, const void *b2, size_t len)
{
return (bcmp(b1, b2, len));
}
static __inline void *
memset(void *b, int c, size_t len)
{
char *bb;
if (c == 0)
bzero(b, len);
else
for (bb = b; len--; )
*bb++ = c;
return (b);
}
#endif /* !_SYS_LIBKERN_H_ */

View File

@ -256,13 +256,4 @@
#ifdef _KERNEL
void panic __P((const char *, ...)) __dead2 __printflike(1, 2);
#endif
/*
* Stop people from using memset/memcpy in the kernel
*/
#ifdef _KERNEL
double memset __P((int dont_use_memset_in_kernel, int a, int b, int c));
#endif
#endif /* _SYS_PARAM_H_ */