[PATCH] speedup in KMimeTypeFactory?

Ingo Klöcker kloecker at kde.org
Sun Oct 19 09:48:30 BST 2008


On Sunday 19 October 2008, Matt Rogers wrote:
> The attached patch makes some changes to the matchFileName function
> in kmimetypefactory.cpp which gets called a lot, especially when
> browsing files in the file manager when trying to open a file.


One suggestion:
> +    int leftBracketIndex = pattern.indexOf(leftBracket);

Use

+    const int leftBracketIndex = pattern.indexOf(leftBracket);

instead. This will not make the code faster, but it will give other 
people reading this code the hint that this variable isn't changed 
afterwards. In general, we should constify anything that can be 
constified.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081019/111d5aca/attachment.sig>


More information about the kde-core-devel mailing list