summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-11-12 10:16:22 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-11-29 22:59:17 +0000
commit51089a5742a79467221b5781cb35a8cea023febf (patch)
tree95f765fa452cdfaa12f986e4d228d9a958c95100 /src/platformsupport
parent14d189f7875b7def6f9745bfd20527a0fce19a44 (diff)
Use Q_UNLIKELY for every qFatal()/qCritical()
If, after checking a condition, we issue a qFatal() or a qCritical(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In some cases, simplified the expressions newly wrapped in Q_UNLIKELY as a drive-by. Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 5aa66a4eaf..58fbaacd2b 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -85,18 +85,18 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
Q_UNUSED(spec);
m_udev = udev_new();
- if (!m_udev)
+ if (Q_UNLIKELY(!m_udev))
qFatal("Failed to get udev context for libinput");
m_li = libinput_udev_create_context(&liInterface, Q_NULLPTR, m_udev);
- if (!m_li)
+ if (Q_UNLIKELY(!m_li))
qFatal("Failed to get libinput context");
libinput_log_set_handler(m_li, liLogHandler);
if (qLcLibInput().isDebugEnabled())
libinput_log_set_priority(m_li, LIBINPUT_LOG_PRIORITY_DEBUG);
- if (libinput_udev_assign_seat(m_li, "seat0"))
+ if (Q_UNLIKELY(libinput_udev_assign_seat(m_li, "seat0")))
qFatal("Failed to assign seat");
m_liFd = libinput_get_fd(m_li);