BaseCalls.h 750 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // Copyright @ 2014 Hangzhou Topzen Ltd.
  3. // Author: Tang (tang@hztopzen.com) @ 2014-12
  4. //
  5. #ifndef __BASECALLS_H
  6. #define __BASECALLS_H
  7. #define TZ_free(ptr) \
  8. do { if ( ptr ) { free(ptr); ptr = NULL; } } while (0)
  9. #define TZ_delete(ptr) \
  10. do { if ( ptr ) { delete ptr; ptr = NULL; } } while (0)
  11. #define TZ_delete_a(ptr) \
  12. do { if ( ptr ) { delete [] ptr; ptr = NULL; } } while (0)
  13. #if defined(WIN32) || defined(WINDOWS) // Windows
  14. #define UNLINK(a) _unlink(a)
  15. #define STRNCPY(a, b, c) strcpy_s(a, c, b)
  16. #define SNPRINTF _snprintf
  17. #elif defined(LINUX) // Linux
  18. #define UNLINK(a) unlink(a)
  19. #define STRNCPY(a, b, c) strncpy(a, b, c)
  20. #define SNPRINTF snprintf
  21. #endif
  22. #endif /* ----- #ifndef __BASECALLS_H ----- */