- Moved hlt() to it's own header.
[coreboot.git] / src / include / string.h
1 #ifndef STRING_H
2 #define STRING_H
3
4 #include <stddef.h>
5
6 // yes, linux has fancy ones. We don't care. This stuff gets used 
7 // hardly at all. And the pain of including those files is just too high.
8
9 //extern inline void strcpy(char *dst, char *src) {while (*src) *dst++ = *src++;}
10
11 //extern inline int strlen(char *src) { int i = 0; while (*src++) i++; return i;}
12
13 static inline size_t strnlen(const char *src, size_t max) 
14
15         size_t i = 0;
16         while((*src++) && (i < max)) {
17                 i++;
18         }
19         return i;
20 }
21
22 static inline size_t strlen(const char *src)
23 {
24         size_t i = 0;
25         while(*src++) {
26                 i++;
27         }
28         return i;
29 }
30
31 extern void *memcpy(void *dest, const void *src, size_t n);
32 extern void *memmove(void *dest, const void *src, size_t n);
33 extern void *memset(void *s, int c, size_t n);
34 extern int memcmp(const void *s1, const void *s2, size_t n);
35
36 extern int sprintf(char * buf, const char *fmt, ...);
37 #endif /* STRING_H */