Refactor the availablePortsByUdev() in favor to readability stable
authorDenis Shienkov <denis.shienkov@gmail.com>
Tue, 3 Jun 2014 18:06:31 +0000 (22:06 +0400)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 7 Jun 2014 16:39:34 +0000 (18:39 +0200)
commit19da18b96897c7d0b9dce2dd589d0135b397005e
treeb827076dbb5d4fb5317a01bb0c1827bf4a7a8a52
parent2cde429d3bd3adc2bfc7d268fb64aad97a07e0e1
Refactor the availablePortsByUdev() in favor to readability

Implementation of the availablePortsByUdev() function is a little
complicated by excess "if/else" conditions and also too long lines,
that worsens readability.

It is reasonable to make the following:

* To get rid of the big "if {...}" blocks in favor to immediate return
from function in case of an error. It will allow to reduce a quantity
of lines and will shift code alignment to the left.

* To split declaration of some long variables and functions into separate
lines, with length at least up to 80~100 characters.

* To drop of the 'struct' keywords and the '::' global namespace
operator for variables.

Tested on ArchLinux 64 bit with the on-board and PL2303 serial ports
using Qt4 and then Qt5.

Tested build on Android x86 using Qt5.

Change-Id: Iddc2a9511230e56e4a9d01a4c22af7b2eaeae60c
Reviewed-by: Peter K├╝mmel <syntheticpp@gmx.net>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
src/serialport/qserialportinfo_unix.cpp