From d7bd022997e6d4fb1c5022d4dfc8c405914bb125 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 29 May 2017 10:54:13 +0200 Subject: [PATCH] fix(src/app/logger/Logger): avoid useless var in release mode --- linphone-desktop/src/Utils.hpp | 2 -- linphone-desktop/src/app/logger/Logger.cpp | 17 ++++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/linphone-desktop/src/Utils.hpp b/linphone-desktop/src/Utils.hpp index 8f0f89fcd..23f88a537 100644 --- a/linphone-desktop/src/Utils.hpp +++ b/linphone-desktop/src/Utils.hpp @@ -28,8 +28,6 @@ // ============================================================================= -class QQuickWindow; - namespace Utils { inline QString linphoneStringToQString (const std::string &string) { return QString::fromLocal8Bit(string.c_str(), static_cast(string.size())); diff --git a/linphone-desktop/src/app/logger/Logger.cpp b/linphone-desktop/src/app/logger/Logger.cpp index 9fa57d3ea..c4b515036 100644 --- a/linphone-desktop/src/app/logger/Logger.cpp +++ b/linphone-desktop/src/app/logger/Logger.cpp @@ -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();