ns_types.h 721 B

1234567891011121314151617181920212223242526272829
  1. #ifndef __NS_TYPES_H
  2. #define __NS_TYPES_H
  3. #include <string.h>
  4. #include <stdint.h>
  5. #include "ns_cfg.h"
  6. #define NS_MEMCPY(d, s, l) memcpy((d), (s), (l))
  7. #define NS_MEMSET(b, c, l) memset((b), (c), (l))
  8. #define NS_MEMCMP(s1, s2, n) memcmp((s1), (s2), (n))
  9. #include <stdlib.h>
  10. #define NS_MALLOC(s) malloc((size_t)(s))
  11. #define NS_FREE(p) \
  12. { \
  13. void* xp = (p); \
  14. if ((xp)) free((xp)); \
  15. }
  16. #define NS_REALLOC(p, n, h, t) realloc((p), (size_t)(n))
  17. #define NS_CALLOC(c, s) calloc(c, s)
  18. #include <stdio.h>
  19. #define NS_LOG(...) \
  20. printf("[netserver]: "); \
  21. printf(__VA_ARGS__); \
  22. printf("\r\n");
  23. #endif /* __NS_TYPES_H */