1 #ifndef _LIBMACH_COMPAT_H_ 2 #define _LIBMACH_COMPAT_H_ 3 4 /* BSD like types */ 5 typedef signed char schar; 6 typedef unsigned char uchar; 7 typedef unsigned int uint; 8 typedef unsigned long ulong; 9 typedef unsigned long long uvlong; 10 11 typedef unsigned short u16int; 12 typedef short s16int; 13 typedef unsigned int u32int; 14 typedef int s32int; 15 typedef unsigned long long u64int; 16 typedef long long s64int; 17 18 #ifndef _WIN32 19 typedef ulong size_t; 20 #endif 21 22 #define offsetof(x,y) FIELD_OFFSET(x,y) 23 #define nil (0) 24 25 #define nelem(arr) (sizeof((arr)[0]) / sizeof((arr))) 26 27 int readn(void *fd, char *buf, ulong len); 28 int seek(void *fd, ulong off, int mode); 29 30 void *RosSymAllocMemZero(ulong num, ulong size); 31 void *RosSymRealloc(void *mem, ulong newsize); 32 void xfree(void *v); 33 34 #define werrstr(str, ...) DPRINT(str "\n" ,##__VA_ARGS__) 35 #define malloc(x) RosSymAllocMem(x) 36 #define mallocz(x,y) RosSymAllocMemZero(x,y) 37 #define free(x) xfree(x) 38 #define USED(x) (*((char *)&(x)) ^= 0) 39 #define memset(x,y,z) RtlZeroMemory(x,z) 40 41 #endif/*_LIBMACH_COMPAT_H_*/ 42