Commit d7bd0229 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(src/app/logger/Logger): avoid useless var in release mode

parent 4939fadd
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
// ============================================================================= // =============================================================================
class QQuickWindow;
namespace Utils { namespace Utils {
inline QString linphoneStringToQString (const std::string &string) { inline QString linphoneStringToQString (const std::string &string) {
return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size())); return QString::fromLocal8Bit(string.c_str(), static_cast<int>(string.size()));
......
...@@ -121,23 +121,22 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri ...@@ -121,23 +121,22 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
} else } else
return; return;
const char *context_str = ""; const char *contextStr = "";
#ifdef QT_MESSAGELOGCONTEXT #ifdef QT_MESSAGELOGCONTEXT
QByteArray contextArr;
QByteArray context_arr;
{ {
const char *file = context.file; const char *file = context.file;
const char *pos = file ? ::Utils::rstrstr(file, SRC_PATTERN) : file; const char *pos = file ? ::Utils::rstrstr(file, SRC_PATTERN) : file;
context_arr = QStringLiteral("%1:%2: ") contextArr = QStringLiteral("%1:%2: ")
.arg(pos ? pos + sizeof(SRC_PATTERN) - 1 : file) .arg(pos ? pos + sizeof(SRC_PATTERN) - 1 : file)
.arg(context.line) .arg(context.line)
.toLocal8Bit(); .toLocal8Bit();
context_str = context_arr.constData(); contextStr = contextArr.constData();
} }
#else
(void)context;
#endif // ifdef QT_MESSAGELOGCONTEXT #endif // ifdef QT_MESSAGELOGCONTEXT
QByteArray localMsg = msg.toLocal8Bit(); QByteArray localMsg = msg.toLocal8Bit();
...@@ -145,8 +144,8 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri ...@@ -145,8 +144,8 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
mMutex.lock(); mMutex.lock();
fprintf(stderr, format, dateTime.constData(), QThread::currentThread(), context_str, localMsg.constData()); fprintf(stderr, format, dateTime.constData(), QThread::currentThread(), contextStr, localMsg.constData());
bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, localMsg.constData()); bctbx_log(QT_DOMAIN, level, "QT: %s%s", contextStr, localMsg.constData());
mMutex.unlock(); mMutex.unlock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment