-#include <xtf/types.h>
+#include <xtf/libc.h>
-size_t strlen(const char *str)
+size_t (strlen)(const char *str)
{
const char *s = str;
return s - str;
}
-int strcmp(const char *_s1, const char *_s2)
+int (strcmp)(const char *_s1, const char *_s2)
{
char s1, s2;
return (s1 < s2) ? -1 : (s1 > s2);
}
-void *memset(void *s, int c, size_t n)
+void *(memset)(void *s, int c, size_t n)
{
char *p = s;
return s;
}
-void *memcpy(void *_d, const void *_s, size_t n)
+void *(memcpy)(void *_d, const void *_s, size_t n)
{
char *d = _d;
const char *s = _s;
return _d;
}
-int memcmp(const void *s1, const void *s2, size_t n)
+int (memcmp)(const void *s1, const void *s2, size_t n)
{
const unsigned char *u1 = s1, *u2 = s2;
int res = 0;
* a call to ???(), which needs implementing in common/libc/
*/
+size_t strlen(const char *str);
#define strlen(s) __builtin_strlen(s)
+
+int strcmp(const char *s1, const char *s2);
#define strcmp(s1, s2) __builtin_strcmp(s1, s2)
+
+void *memset(void *s, int c, size_t n);
#define memset(d, c, n) __builtin_memset(d, c, n)
+
+void *memcpy(void *dst, const void *src, size_t n);
#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
+
+int memcmp(const void *s1, const void *s2, size_t n);
#define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)
-size_t strlen(const char *str);
size_t strnlen(const char *str, size_t max);
-int strcmp(const char *s1, const char *s2);
-void *memset(void *s, int c, size_t n);
-void *memcpy(void *dst, const void *src, size_t n);
-int memcmp(const void *s1, const void *s2, size_t n);
int __printf(3, 0)
vsnprintf(char *buf, size_t size, const char *fmt, va_list args);