dbaa1ecd1768ce6110dc55576f121502c7263be0
[coreboot.git] / util / mkelfImage / kunzip_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   int i = 0; 
15   if (max<0) {
16     while (*src++) 
17       i++; 
18     return i;
19   }
20   else {
21     while ((*src++) && (i < max)) 
22       i++; 
23     return i;
24   }
25 }
26
27 extern void *memcpy(void *dest, const void *src, size_t n);
28 extern void *memset(void *s, int c, size_t n);
29 extern int memcmp(const void *s1, const void *s2, size_t n);
30
31 #endif /* STRING_H */