mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
do not throw exception on allocation failure [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
0658cffbae
commit
7726e3c09c
2 changed files with 12 additions and 31 deletions
|
@ -968,24 +968,6 @@ const char *qVersion()
|
||||||
If this macro is used outside a function, the behavior is undefined.
|
If this macro is used outside a function, the behavior is undefined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
The Q_CHECK_PTR macro calls this function if an allocation check
|
|
||||||
fails.
|
|
||||||
*/
|
|
||||||
void qt_check_pointer(const char *n, int l)
|
|
||||||
{
|
|
||||||
qFatal("In file %s, line %d: Out of memory", n, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* \internal
|
|
||||||
Allows you to throw an exception without including <new>
|
|
||||||
Called internally from Q_CHECK_PTR on certain OS combinations
|
|
||||||
*/
|
|
||||||
void qBadAlloc()
|
|
||||||
{
|
|
||||||
QT_THROW(std::bad_alloc());
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_NO_EXECINFO
|
#ifndef QT_NO_EXECINFO
|
||||||
static void qt_print_backtrace()
|
static void qt_print_backtrace()
|
||||||
{
|
{
|
||||||
|
@ -1113,6 +1095,15 @@ void qt_assert_x(const char *where, const char *what, const char *file, int line
|
||||||
qFatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);
|
qFatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The Q_CHECK_PTR macro calls this function if an allocation check
|
||||||
|
fails.
|
||||||
|
*/
|
||||||
|
void qt_check_pointer(const char *file, int line)
|
||||||
|
{
|
||||||
|
qFatal("In file %s, line %d: Out of memory", file, line);
|
||||||
|
}
|
||||||
|
|
||||||
static QtMsgHandler handler = 0; // pointer to debug handler
|
static QtMsgHandler handler = 0; // pointer to debug handler
|
||||||
|
|
||||||
QString qt_error_string(int errorCode)
|
QString qt_error_string(int errorCode)
|
||||||
|
|
|
@ -394,26 +394,16 @@ Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */
|
||||||
|
|
||||||
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
|
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
|
||||||
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);
|
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);
|
||||||
|
Q_CORE_EXPORT void qt_check_pointer(const char *file, int line);
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
# define Q_ASSERT(cond) do { if(!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
|
# define Q_ASSERT(cond) do { if(!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (0)
|
||||||
# define Q_ASSERT_X(cond, where, what) do { if(!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
|
# define Q_ASSERT_X(cond, where, what) do { if(!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (0)
|
||||||
|
# define Q_CHECK_PTR(p) do { if(!p) qt_check_pointer(__FILE__,__LINE__); } while (0)
|
||||||
#else
|
#else
|
||||||
# define Q_ASSERT(cond)
|
# define Q_ASSERT(cond)
|
||||||
# define Q_ASSERT_X(cond, where, what)
|
# define Q_ASSERT_X(cond, where, what)
|
||||||
#endif
|
|
||||||
|
|
||||||
Q_CORE_EXPORT void qt_check_pointer(const char *, int);
|
|
||||||
Q_CORE_EXPORT void qBadAlloc();
|
|
||||||
|
|
||||||
#ifdef QT_NO_EXCEPTIONS
|
|
||||||
# if defined(QT_NO_DEBUG)
|
|
||||||
# define Q_CHECK_PTR(p)
|
# define Q_CHECK_PTR(p)
|
||||||
# else
|
|
||||||
# define Q_CHECK_PTR(p) do { if(!p) qt_check_pointer(__FILE__,__LINE__); } while (0)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define Q_CHECK_PTR(p) do { if(!p) qBadAlloc(); } while (0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg };
|
enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg };
|
||||||
|
|
Loading…
Add table
Reference in a new issue