Skip to content

Commit ec510c1

Browse files
N-Dekkerhjmjohnson
authored andcommitted
STYLE: Replace postfix with prefix increment, decrement (++, --)
Applied to the root of ITK source tree, at the GNU bash prompt: find . \( -iname itk*.cxx -or -iname itk*.hxx -or -iname itk*.h \) -exec perl -pi -w -e 's/ (\w+)\+\+;/ ++$1;/g;' {} \; find . \( -iname itk*.cxx -or -iname itk*.hxx -or -iname itk*.h \) -exec perl -pi -w -e 's/ (\w+)\-\-;/ --$1;/g;' {} \; Excluded itkConceptChecking.h, as it is intended to check both the prefix *and* the postfix forms. Excluded the unit tests, as they might intentionally test the postfix forms. Follow-up to: pull request #2493 commit f81578b "STYLE: Replace postfix by prefix increment in `for` loops in Core/Common"
1 parent 73e883d commit ec510c1

225 files changed

Lines changed: 705 additions & 705 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Modules/Compatibility/Deprecated/include/itkChildTreeIterator.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ template <typename TTreeType>
106106
auto
107107
ChildTreeIterator<TTreeType>::Next() -> const ValueType &
108108
{
109-
m_ListPosition++;
109+
++m_ListPosition;
110110
this->m_Position = m_ParentNode->GetChild(m_ListPosition);
111111
if (this->m_Position == nullptr)
112112
{

Modules/Compatibility/Deprecated/include/itkInOrderTreeIterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ InOrderTreeIterator<TTreeType>::FindNextNode() const
139139
{
140140
return help;
141141
}
142-
childPosition++;
142+
++childPosition;
143143
}
144144

145145
while (parent->HasParent())

Modules/Compatibility/Deprecated/include/itkLevelOrderTreeIterator.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ LevelOrderTreeIterator<TTreeType>::GetLevel() const
159159
while (node->HasParent() && node != this->m_Root)
160160
{
161161
node = dynamic_cast<TreeNodeType *>(node->GetParent());
162-
level++;
162+
++level;
163163
}
164164
return level;
165165
}
@@ -178,7 +178,7 @@ LevelOrderTreeIterator<TTreeType>::GetLevel(const TreeNodeType * node) const
178178
while (node->HasParent() && node != this->m_Root)
179179
{
180180
node = dynamic_cast<const TreeNodeType *>(node->GetParent());
181-
level++;
181+
++level;
182182
}
183183
return level;
184184
}

Modules/Compatibility/Deprecated/include/itkPostOrderTreeIterator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ PostOrderTreeIterator<TTreeType>::FindSister(TreeNodeType * node) const
166166
{
167167
if (parent->GetChild(childPosition + 1) == nullptr)
168168
{
169-
childPosition++;
169+
++childPosition;
170170
}
171171
else
172172
{
@@ -206,7 +206,7 @@ PostOrderTreeIterator<TTreeType>::FindMostRightLeaf(TreeNodeType * node) const
206206
itkGenericExceptionMacro(<< "Can't downcast to TreeNodeType *");
207207
}
208208
}
209-
i++;
209+
++i;
210210
} while (helpNode == nullptr && i < childCount);
211211

212212
if (helpNode == nullptr)

Modules/Compatibility/Deprecated/include/itkPreOrderTreeIterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ PreOrderTreeIterator<TTreeType>::FindNextNode() const
150150
{
151151
return help;
152152
}
153-
childPosition++;
153+
++childPosition;
154154
}
155155
}
156156
return nullptr;

Modules/Compatibility/Deprecated/include/itkTreeContainer.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ TreeContainer<TValue>::Count() const
8282
it.GoToBegin();
8383
while (!it.IsAtEnd())
8484
{
85-
size++;
85+
++size;
8686
++it;
8787
}
8888
return size;

Modules/Compatibility/Deprecated/include/itkTreeIteratorBase.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ TreeIteratorBase<TTreeType>::Count()
438438
}
439439
while (this->Next())
440440
{
441-
size++;
441+
++size;
442442
}
443443
return size;
444444
}

Modules/Core/Common/include/itkAnnulusOperator.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ AnnulusOperator<TPixel, TDimension, TAllocator>::GenerateCoefficients() -> Coeff
140140
coeffP[i] = annulusV;
141141
sumNotExterior += annulusV;
142142
sumNotExteriorSq += (annulusV * annulusV);
143-
countNotExterior++;
143+
++countNotExterior;
144144
outside[i] = false;
145145
}
146146
else
@@ -149,7 +149,7 @@ AnnulusOperator<TPixel, TDimension, TAllocator>::GenerateCoefficients() -> Coeff
149149
coeffP[i] = interiorV;
150150
sumNotExterior += interiorV;
151151
sumNotExteriorSq += (interiorV * interiorV);
152-
countNotExterior++;
152+
++countNotExterior;
153153
outside[i] = false;
154154
}
155155
}

Modules/Core/Common/include/itkBoundingBox.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::IsI
322322
{
323323
return false;
324324
}
325-
i++;
325+
++i;
326326
}
327327
return true;
328328
}

Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,26 @@ class ITK_TEMPLATE_EXPORT ConstShapedNeighborhoodIterator : private Neighborhood
141141
void
142142
operator++(int)
143143
{
144-
m_ListIterator++;
144+
++m_ListIterator;
145145
}
146146

147147
void
148148
operator--(int)
149149
{
150-
m_ListIterator--;
150+
--m_ListIterator;
151151
}
152152

153153
const ConstIterator &
154154
operator++()
155155
{
156-
m_ListIterator++;
156+
++m_ListIterator;
157157
return *this;
158158
}
159159

160160
const ConstIterator &
161161
operator--()
162162
{
163-
m_ListIterator--;
163+
--m_ListIterator;
164164
return *this;
165165
}
166166

0 commit comments

Comments
 (0)