os.h 983 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef OS_H
  2. #define OS_H
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include "wm_mem.h"
  7. #ifndef os_strlen
  8. #define os_strlen(s) strlen(s)
  9. #endif
  10. void * os_zalloc(u32 size);
  11. void * os_realloc(void *ptr, size_t size);
  12. char * os_strdup(const char *s);
  13. #define os_time_after(a, b) ((long)(b) - (long)(a) < 0)
  14. #ifndef os_memcpy
  15. #define os_memcpy(d, s, n) MEMCPY((d), (s), (n))
  16. #endif
  17. #ifndef os_memmove
  18. #define os_memmove(d, s, n) memmove((d), (s), (n))
  19. #endif
  20. #ifndef os_memset
  21. #define os_memset(s, c, n) memset(s, c, n)
  22. #endif
  23. #ifndef os_memcmp
  24. #define os_memcmp(s1, s2, n) memcmp((s1), (s2), (n))
  25. #endif
  26. #ifndef os_strstr
  27. #define os_strstr(h, n) strstr((h), (n))
  28. #endif
  29. #ifndef os_strcmp
  30. #define os_strcmp(s1, s2) strcmp((s1), (s2))
  31. #endif
  32. #ifndef os_strncmp
  33. #define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
  34. #endif
  35. #ifndef os_strchr
  36. #define os_strchr(s, c) strchr((s), (c))
  37. #endif
  38. #ifndef os_strcpy
  39. #define os_strcpy(s1,s2) strcpy((s1),(s2))
  40. #endif
  41. #endif