diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-11-12 10:16:22 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-11-29 22:59:17 +0000 |
commit | 51089a5742a79467221b5781cb35a8cea023febf (patch) | |
tree | 95f765fa452cdfaa12f986e4d228d9a958c95100 /src/dbus/qdbus_symbols.cpp | |
parent | 14d189f7875b7def6f9745bfd20527a0fce19a44 (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/dbus/qdbus_symbols.cpp')
-rw-r--r-- | src/dbus/qdbus_symbols.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index 395a436869..3f5df41582 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -130,11 +130,11 @@ void (*qdbus_resolve_conditionally(const char *name))() void (*qdbus_resolve_me(const char *name))() { #ifndef QT_NO_LIBRARY - if (!qdbus_loadLibDBus()) + if (Q_UNLIKELY(!qdbus_loadLibDBus())) qFatal("Cannot find libdbus-1 in your system to resolve symbol '%s'.", name); QFunctionPointer ptr = qdbus_libdbus->resolve(name); - if (!ptr) + if (Q_UNLIKELY(!ptr)) qFatal("Cannot resolve '%s' in your libdbus-1.", name); return ptr; |