From 8a30a60a03af3979de8988209f8f77638713c30d Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 3 May 2016 17:05:50 +0300 Subject: Remove superfluous check during removal of the pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... as deleting of a null-pointer it is a valid operation. Change-Id: Ia4ffd8b69ab75b9e3b200ce2ce999ab2820b915e Reviewed-by: Frank Meerkoetter Reviewed-by: André Hartmann --- src/serialport/qserialport_unix.cpp | 12 ++++-------- src/serialport/qserialport_win.cpp | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 7153449..7662a90 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -244,15 +244,11 @@ void QSerialPortPrivate::close() ::ioctl(descriptor, TIOCNXCL); #endif - if (readNotifier) { - delete readNotifier; - readNotifier = Q_NULLPTR; - } + delete readNotifier; + readNotifier = Q_NULLPTR; - if (writeNotifier) { - delete writeNotifier; - writeNotifier = Q_NULLPTR; - } + delete writeNotifier; + writeNotifier = Q_NULLPTR; qt_safe_close(descriptor); diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index e356e4c..1680d5a 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -106,15 +106,11 @@ void QSerialPortPrivate::close() { ::CancelIo(handle); - if (notifier) { - delete notifier; - notifier = Q_NULLPTR; - } + delete notifier; + notifier = Q_NULLPTR; - if (startAsyncWriteTimer) { - delete startAsyncWriteTimer; - startAsyncWriteTimer = Q_NULLPTR; - } + delete startAsyncWriteTimer; + startAsyncWriteTimer = Q_NULLPTR; communicationStarted = false; readStarted = false; -- cgit v1.2.1