assert.h 839 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT-like 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. #ifdef assert
  14. #undef assert
  15. #endif//assert
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. extern void Assert_Throw(int failed, const char *exp, const char *func, const char *file, int line, const char *str);
  20. #ifdef __cplusplus
  21. }
  22. #endif
  23. #define assert(exp) Assert_Throw(!(exp), #exp, __FUNCTION__, __FILE__, __LINE__, NULL)
  24. #endif //ZLMEDIAKIT_ASSERT_H