Review Request: Optimize bad_ports check in KIO::precheckHttpPost()

Thiago Macieira thiago at kde.org
Mon Jun 1 07:57:56 BST 2009


Christoph Feck wrote:
>-----------------------------------------------------------
>This is an automatically generated e-mail. To reply, visit:
>http://reviewboard.kde.org/r/786/
>-----------------------------------------------------------
>
>(Updated 2009-05-31 22:21:53.692629)
>
>
>Review request for kdelibs.
>
>
>Summary
>-------
>
>While browsing "job.cpp" I noticed that KIO uses a simple loop to check
> for bad ports. Most times, however, port 80 is passed, and this patch
> adds a check for this. Additionally, this patch uses qBinaryFind,
> instead of a loop.
>
>Maybe some Qt/core wizard can comment on the correct usage (and actual
> improvement) of qBinaryFind, especially the "end" iterator :)

Patch makes sense, but it's also an overkill.

Changing the for continuation loop to bad_ports[cnt] && bad_ports[cnt] <= 
port would be enough.

Also, caching the value of url.port() would be an improvement too (which 
your patch already does).

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090601/35e97dca/attachment.sig>


More information about the kde-core-devel mailing list