mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: simplify short-circuit involving autoPtr (#1775)
- with '&&' conditions, often better to check for non-null autoPtr
first (it is cheap)
- check as bool instead of valid() method for cleaner code, especially
when the wrapped item itself has a valid/empty or good.
Also when handling multiple checks.
Now
if (ptr && ptr->valid())
if (ptr1 || ptr2)
instead
if (ptr.valid() && ptr->valid())
if (ptr1.valid() || ptr2.valid())
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -128,8 +128,8 @@ void Foam::globalMeshData::calcSharedPoints() const
|
||||
if
|
||||
(
|
||||
nGlobalPoints_ != -1
|
||||
|| sharedPointLabelsPtr_.valid()
|
||||
|| sharedPointAddrPtr_.valid()
|
||||
|| sharedPointLabelsPtr_
|
||||
|| sharedPointAddrPtr_
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -295,8 +295,8 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
if
|
||||
(
|
||||
nGlobalEdges_ != -1
|
||||
|| sharedEdgeLabelsPtr_.valid()
|
||||
|| sharedEdgeAddrPtr_.valid()
|
||||
|| sharedEdgeLabelsPtr_
|
||||
|| sharedEdgeAddrPtr_
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
Reference in New Issue
Block a user