You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
932B

  1. /*
  2. * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef ZLMEDIAKIT_ASSERT_H
  11. #define ZLMEDIAKIT_ASSERT_H
  12. #include <stdio.h>
  13. #ifndef NDEBUG
  14. #ifdef assert
  15. #undef assert
  16. #endif//assert
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. extern void Assert_Throw(int failed, const char *exp, const char *func, const char *file, int line, const char *str);
  21. #ifdef __cplusplus
  22. }
  23. #endif
  24. #define assert(exp) Assert_Throw(!(exp), #exp, __FUNCTION__, __FILE__, __LINE__, NULL)
  25. #else
  26. #define assert(e) ((void)0)
  27. #endif//NDEBUG
  28. #endif //ZLMEDIAKIT_ASSERT_H