Commit 19da18b9 authored by Denis Shienkov's avatar Denis Shienkov Committed by The Qt Project
Browse files

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: default avatarPeter Kümmel <syntheticpp@gmx.net>
Reviewed-by: default avatarSergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: default avatarDenis Shienkov <denis.shienkov@gmail.com>
parent 2cde429d
Showing with 38 additions and 48 deletions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment