[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra=5D_libs/kotext=3A_Optimize_the_use_of_cont?=
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2011-06-12 4:21:30
Message-ID: 20110612042130.81543A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit d4f0ca53c34907c002827f7c18a798fdba74ba2a by Thorsten Zachmann.
Committed on 12/06/2011 at 06:17.
Pushed by zachmann into branch 'master'.

Optimize the use of contains and value

contains is not needed in this case. Just call value with a default parameter

M  +1    -3    libs/kotext/KoInlineTextObjectManager.cpp     

http://commits.kde.org/calligra/d4f0ca53c34907c002827f7c18a798fdba74ba2a

diff --git a/libs/kotext/KoInlineTextObjectManager.cpp b/libs/kotext/KoInlineTextObjectManager.cpp
index 21836dd..2a759aa 100644
--- a/libs/kotext/KoInlineTextObjectManager.cpp
+++ b/libs/kotext/KoInlineTextObjectManager.cpp
@@ -45,9 +45,7 @@ KoInlineObject *KoInlineTextObjectManager::inlineTextObject(const QTextCharForma
     int id = format.intProperty(InlineInstanceId);
     if (id <= 0)
         return 0;
-    if (!m_objects.contains(id))
-        return 0;
-    return m_objects.value(id);
+    return m_objects.value(id, 0);
 }
 
 KoInlineObject *KoInlineTextObjectManager::inlineTextObject(const QTextCursor &cursor) const

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic