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 @@
// =============================================================================
class QQuickWindow;
namespace Utils {
inline QString linphoneStringToQString (const std::string &string) {
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
} else
return;
const char *context_str = "";
const char *contextStr = "";
#ifdef QT_MESSAGELOGCONTEXT
QByteArray context_arr;
QByteArray contextArr;
{
const char *file = context.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(context.line)
.toLocal8Bit();
context_str = context_arr.constData();
contextStr = contextArr.constData();
}
#else
(void)context;
#endif // ifdef QT_MESSAGELOGCONTEXT
QByteArray localMsg = msg.toLocal8Bit();
......@@ -145,8 +144,8 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
mMutex.lock();
fprintf(stderr, format, dateTime.constData(), QThread::currentThread(), context_str, localMsg.constData());
bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, localMsg.constData());
fprintf(stderr, format, dateTime.constData(), QThread::currentThread(), contextStr, localMsg.constData());
bctbx_log(QT_DOMAIN, level, "QT: %s%s", contextStr, localMsg.constData());
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