Fixed Lua interpreter crap.
My memcmp() implementation was non standards compliant. Fuck.alentours-dev
parent
58682720e1
commit
57601cac2c
|
@ -12,9 +12,9 @@ char *strstr(const char *haystack, const char *needle);
|
|||
unsigned long long int strspn(const char *s, const char *accept);
|
||||
void *memchr(const void *s, int c, unsigned long long int n);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
int memcmp(const void *s1, const void *s2, unsigned long int n);
|
||||
|
||||
#define strcoll(A, B) strcmp(A, B)
|
||||
#define strlen(A) kstrlen(A)
|
||||
#define memcpy(A, B, C) kmemcpy(A, B, C)
|
||||
#define memcmp(A, B, C) kmemcmp((const u8*)A, (const u8*)B, C)
|
||||
#endif
|
||||
|
|
|
@ -259,6 +259,20 @@ void free(void *ptr)
|
|||
}
|
||||
|
||||
// string.h implementation
|
||||
int memcmp(const void *s1, const void *s2, unsigned long int n)
|
||||
{
|
||||
const unsigned char *p1 = s1, *p2 = s2;
|
||||
while(n--)
|
||||
if( *p1 != *p2 )
|
||||
return *p1 - *p2;
|
||||
else
|
||||
{
|
||||
p1++;
|
||||
p2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *strchr (const char *str, int character)
|
||||
{
|
||||
while (*str != 0)
|
||||
|
|
Loading…
Reference in New Issue