forked from premiere/premiere-libtorrent
fix production assert
This commit is contained in:
parent
524e116277
commit
b9be2fe94b
|
@ -56,7 +56,9 @@ std::string demangle(char const* name);
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, char const* function, char const* val);
|
TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file
|
||||||
|
, char const* function, char const* val);
|
||||||
|
|
||||||
#define TORRENT_ASSERT(x) do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, 0); } while (false)
|
#define TORRENT_ASSERT(x) do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, 0); } while (false)
|
||||||
#if TORRENT_USE_IOSTREAM
|
#if TORRENT_USE_IOSTREAM
|
||||||
#define TORRENT_ASSERT_VAL(x, y) do { if (x) {} else { std::stringstream __s__; __s__ << #y ": " << y; assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, __s__.str().c_str()); } } while (false)
|
#define TORRENT_ASSERT_VAL(x, y) do { if (x) {} else { std::stringstream __s__; __s__ << #y ": " << y; assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__, __s__.str().c_str()); } } while (false)
|
||||||
|
|
|
@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_ASIO_DEBUGGING || TORRENT_RELEASE_ASSERTS
|
#if defined TORRENT_DEBUG || defined TORRENT_ASIO_DEBUGGING || TORRENT_RELEASE_ASSERTS
|
||||||
|
|
||||||
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,7 +124,8 @@ void print_backtrace(char* out, int len) {}
|
||||||
char const* libtorrent_assert_log = "asserts.log";
|
char const* libtorrent_assert_log = "asserts.log";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void assert_fail(char const* expr, int line, char const* file, char const* function, char const* value)
|
TORRENT_EXPORT void assert_fail(char const* expr, int line, char const* file
|
||||||
|
, char const* function, char const* value)
|
||||||
{
|
{
|
||||||
#if TORRENT_PRODUCTION_ASSERTS
|
#if TORRENT_PRODUCTION_ASSERTS
|
||||||
FILE* out = fopen(libtorrent_assert_log, "a+");
|
FILE* out = fopen(libtorrent_assert_log, "a+");
|
||||||
|
|
Loading…
Reference in New Issue