Next in my series of cleanups form the alpha port nothing should break yet...

This commit is contained in:
Eric W. Biederman 2001-03-23 21:03:13 +00:00
commit 24fe8d03aa
28 changed files with 1672 additions and 143 deletions

View file

@ -1,3 +1,8 @@
#ifndef STRING_H
#define STRING_H
#include <stddef.h>
// yes, linux has fancy ones. We don't care. This stuff gets used
// hardly at all. And the pain of including those files is just too high.
@ -5,8 +10,7 @@
//extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
#if 1
extern inline int strnlen(const char *src, int max) {
static inline size_t strnlen(const char *src, size_t max) {
int i = 0;
if (max<0) {
while (*src++)
@ -19,23 +23,9 @@ extern inline int strnlen(const char *src, int max) {
return i;
}
}
#else
static inline size_t strnlen(const char * s, size_t count)
{
int d0;
register int __res;
__asm__ __volatile__(
"movl %2,%0\n\t"
"jmp 2f\n"
"1:\tcmpb $0,(%0)\n\t"
"je 3f\n\t"
"incl %0\n"
"2:\tdecl %1\n\t"
"cmpl $-1,%1\n\t"
"jne 1b\n"
"3:\tsubl %2,%0"
:"=a" (__res), "=&d" (d0)
:"c" (s),"1" (count));
return __res;
}
#endif
extern void *memcpy(void *dest, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n);
extern int memcmp(const void *s1, const void *s2, size_t n);
#endif /* STRING_H */