Skip to content

Commit 2c7d41f

Browse files
committed
STYLE: Update clang-format to match ITK 2025-11-10
1 parent 3d4ac3b commit 2c7d41f

File tree

4 files changed

+63
-48
lines changed

4 files changed

+63
-48
lines changed

.clang-format

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## This config file is only relevant for clang-format version 19.1.4
1+
## This config file is only relevant for clang-format version 19.1.7
22
##
33
## Examples of each format style can be found on the in the clang-format documentation
44
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
@@ -10,11 +10,11 @@
1010
## maintaining a consistent code style.
1111
##
1212
## EXAMPLE apply code style enforcement before commit:
13-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified
13+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --modified
1414
## EXAMPLE apply code style enforcement after commit:
15-
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last
15+
# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.7} --last
1616
---
17-
# This configuration requires clang-format version 19.1.4 exactly.
17+
# This configuration requires clang-format version 19.1.7 exactly.
1818
Language: Cpp
1919
AccessModifierOffset: -2
2020
AlignAfterOpenBracket: Align
@@ -297,6 +297,7 @@ StatementMacros:
297297
- ITK_CLANG_PRAGMA_PUSH
298298
- ITK_CLANG_PRAGMA_POP
299299
- ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
300+
- ITK_CLANG_SUPPRESS_Wduplicate_enum
300301
- CLANG_PRAGMA_PUSH
301302
- CLANG_PRAGMA_POP
302303
- CLANG_SUPPRESS_Wfloat_equal

.github/workflows/clang-format-linter.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v1
10+
- uses: actions/checkout@v5
1111

12-
- uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master
12+
- uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@main
13+
with:
14+
itk-branch: main

include/itkFastGrowCut.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ template <typename TInputImage, typename TLabelImage, typename TMaskImage>
371371
void
372372
FastGrowCut<TInputImage, TLabelImage, TMaskImage>::GenerateData()
373373
{
374-
auto inputImage = this->GetInput();
374+
auto inputImage = this->GetInput();
375375
// auto seedImage = this->GetSeedImage();
376376
auto outputImage = this->GetOutput();
377377
RegionType inRegion = inputImage->GetLargestPossibleRegion();

src/FibHeap.cxx

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
using namespace std;
1414

15-
#define OK 0
16-
#define NOTOK -1
15+
#define OK 0
16+
#define NOTOK -1
1717

18-
const NodeIndexType FibHeapNode::NullNodeIndex = 0xFFFFFFFF;
18+
const NodeIndexType FibHeapNode::NullNodeIndex = 0xFFFFFFFF;
1919
const NodeKeyValueType FibHeapNode::NegativeInfinity = -std::numeric_limits<NodeKeyValueType>::infinity();
2020

2121
//-----------------------------------------------------------------------------
@@ -30,13 +30,15 @@ FibHeap::FibHeap()
3030
FibHeap::~FibHeap() = default;
3131

3232
//-----------------------------------------------------------------------------
33-
void FibHeap::SetHeapNodes(FibHeapNode* heapNodes)
33+
void
34+
FibHeap::SetHeapNodes(FibHeapNode * heapNodes)
3435
{
3536
m_HeapNodes = heapNodes;
3637
}
3738

3839
//-----------------------------------------------------------------------------
39-
void FibHeap::Insert(FibHeapNode* NewNode)
40+
void
41+
FibHeap::Insert(FibHeapNode * NewNode)
4042
{
4143
if (NewNode == nullptr)
4244
{
@@ -74,7 +76,8 @@ void FibHeap::Insert(FibHeapNode* NewNode)
7476
}
7577

7678
//-----------------------------------------------------------------------------
77-
void FibHeap::Union(FibHeap *OtherHeap)
79+
void
80+
FibHeap::Union(FibHeap * OtherHeap)
7881
{
7982
if (OtherHeap == nullptr || OtherHeap->m_MinRoot == nullptr)
8083
{
@@ -85,10 +88,10 @@ void FibHeap::Union(FibHeap *OtherHeap)
8588
// min node and the node after the min. This code just pulls those
8689
// nodes into temporary variables so we don't get lost as changes
8790
// are made.
88-
FibHeapNode* Min1 = m_MinRoot;
89-
FibHeapNode* Min2 = OtherHeap->m_MinRoot;
90-
FibHeapNode* Next1 = HeapNodeFromIndex(Min1->m_Right);
91-
FibHeapNode* Next2 = HeapNodeFromIndex(Min2->m_Right);
91+
FibHeapNode * Min1 = m_MinRoot;
92+
FibHeapNode * Min2 = OtherHeap->m_MinRoot;
93+
FibHeapNode * Next1 = HeapNodeFromIndex(Min1->m_Right);
94+
FibHeapNode * Next2 = HeapNodeFromIndex(Min2->m_Right);
9295

9396
// To join the two circles, we join the minimum nodes to the next
9497
// nodes on the opposite chains. Conceptually, it looks like the way
@@ -112,7 +115,7 @@ void FibHeap::Union(FibHeap *OtherHeap)
112115

113116
// Complete the union by setting the other heap to emptiness
114117
// then destroying it
115-
OtherHeap->m_MinRoot = nullptr;
118+
OtherHeap->m_MinRoot = nullptr;
116119
OtherHeap->m_NumNodes = 0;
117120
OtherHeap->m_NumTrees = 0;
118121
OtherHeap->m_NumMarkedNodes = 0;
@@ -121,10 +124,11 @@ void FibHeap::Union(FibHeap *OtherHeap)
121124
}
122125

123126
//-----------------------------------------------------------------------------
124-
FibHeapNode *FibHeap::ExtractMin()
127+
FibHeapNode *
128+
FibHeap::ExtractMin()
125129
{
126-
FibHeapNode *Result;
127-
FibHeap *ChildHeap = nullptr;
130+
FibHeapNode * Result;
131+
FibHeap * ChildHeap = nullptr;
128132

129133
// Remove minimum node and set m_MinRoot to next node
130134
if ((Result = Minimum()) == nullptr)
@@ -137,10 +141,10 @@ FibHeapNode *FibHeap::ExtractMin()
137141
m_HeapNodes[Result->m_Left].m_Right = Result->m_Right;
138142
Result->m_Left = Result->m_Right = FibHeapNode::NullNodeIndex;
139143

140-
m_NumNodes --;
144+
m_NumNodes--;
141145
if (Result->m_Mark)
142146
{
143-
m_NumMarkedNodes --;
147+
m_NumMarkedNodes--;
144148
Result->m_Mark = false;
145149
}
146150
Result->m_Degree = 0;
@@ -196,7 +200,8 @@ FibHeapNode *FibHeap::ExtractMin()
196200
}
197201

198202
//-----------------------------------------------------------------------------
199-
int FibHeap::DecreaseKey(FibHeapNode* theNode, NodeKeyValueType keyValue)
203+
int
204+
FibHeap::DecreaseKey(FibHeapNode * theNode, NodeKeyValueType keyValue)
200205
{
201206
if (theNode == nullptr || theNode->m_Key < keyValue)
202207
{
@@ -205,7 +210,7 @@ int FibHeap::DecreaseKey(FibHeapNode* theNode, NodeKeyValueType keyValue)
205210

206211
(*theNode) = keyValue;
207212

208-
FibHeapNode* theParent = HeapNodeFromIndex(theNode->m_Parent);
213+
FibHeapNode * theParent = HeapNodeFromIndex(theNode->m_Parent);
209214
if (theParent != nullptr && *theNode < *theParent)
210215
{
211216
Cut(theNode, theParent);
@@ -221,7 +226,8 @@ int FibHeap::DecreaseKey(FibHeapNode* theNode, NodeKeyValueType keyValue)
221226
}
222227

223228
//-----------------------------------------------------------------------------
224-
int FibHeap::Delete(FibHeapNode *theNode)
229+
int
230+
FibHeap::Delete(FibHeapNode * theNode)
225231
{
226232
if (theNode == nullptr)
227233
{
@@ -247,14 +253,15 @@ int FibHeap::Delete(FibHeapNode *theNode)
247253
}
248254

249255
//-----------------------------------------------------------------------------
250-
void FibHeap::Print(FibHeapNode *tree, FibHeapNode *theParent)
256+
void
257+
FibHeap::Print(FibHeapNode * tree, FibHeapNode * theParent)
251258
{
252259
if (tree == nullptr)
253260
{
254261
tree = m_MinRoot;
255262
}
256263

257-
FibHeapNode* temp = tree;
264+
FibHeapNode * temp = tree;
258265
do
259266
{
260267
if (temp->m_Left == FibHeapNode::NullNodeIndex)
@@ -306,7 +313,7 @@ void FibHeap::Print(FibHeapNode *tree, FibHeapNode *theParent)
306313
Print(HeapNodeFromIndex(temp->m_Child), temp);
307314
}
308315
temp = HeapNodeFromIndex(temp->m_Right);
309-
} while (temp !=nullptr && temp != tree);
316+
} while (temp != nullptr && temp != tree);
310317

311318
if (theParent == nullptr)
312319
{
@@ -317,12 +324,13 @@ void FibHeap::Print(FibHeapNode *tree, FibHeapNode *theParent)
317324
}
318325

319326
//-----------------------------------------------------------------------------
320-
void FibHeap::Consolidate()
327+
void
328+
FibHeap::Consolidate()
321329
{
322330
// Initialize the consolidation detection array
323-
const int Dn = 1 + 8 * sizeof(long);
324-
FibHeapNode *A[Dn]; // 1+lg(n)
325-
for (int i=0; i < Dn; i++)
331+
const int Dn = 1 + 8 * sizeof(long);
332+
FibHeapNode * A[Dn]; // 1+lg(n)
333+
for (int i = 0; i < Dn; i++)
326334
{
327335
A[i] = nullptr;
328336
}
@@ -338,15 +346,15 @@ void FibHeap::Consolidate()
338346

339347
m_HeapNodes[m_MinRoot->m_Left].m_Right = FibHeapNode::NullNodeIndex;
340348
m_MinRoot->m_Left = FibHeapNode::NullNodeIndex;
341-
FibHeapNode* w = m_MinRoot;
349+
FibHeapNode * w = m_MinRoot;
342350

343-
FibHeapNode* x;
344-
FibHeapNode* y;
345-
short d;
351+
FibHeapNode * x;
352+
FibHeapNode * y;
353+
short d;
346354
do
347355
{
348-
//cout << "Top of Consolidate's loop\n";
349-
//Print(w);
356+
// cout << "Top of Consolidate's loop\n";
357+
// Print(w);
350358

351359
x = w;
352360
d = x->m_Degree;
@@ -369,8 +377,8 @@ void FibHeap::Consolidate()
369377
Link(y, x);
370378
A[d] = nullptr;
371379
d++;
372-
//cout << "After a round of Linking\n";
373-
//Print(x);
380+
// cout << "After a round of Linking\n";
381+
// Print(x);
374382
}
375383
A[d] = x;
376384

@@ -391,7 +399,8 @@ void FibHeap::Consolidate()
391399
}
392400

393401
//-----------------------------------------------------------------------------
394-
void FibHeap::Link(FibHeapNode *y, FibHeapNode *x)
402+
void
403+
FibHeap::Link(FibHeapNode * y, FibHeapNode * x)
395404
{
396405
// Remove node y from root list
397406
if (y->m_Right != FibHeapNode::NullNodeIndex)
@@ -423,7 +432,7 @@ void FibHeap::Link(FibHeapNode *y, FibHeapNode *x)
423432
}
424433

425434
// Increase the degree of node x because it's now a bigger tree
426-
x->m_Degree ++;
435+
x->m_Degree++;
427436

428437
// Node y has just been made a child, so clear its mark
429438
if (y->m_Mark)
@@ -434,7 +443,8 @@ void FibHeap::Link(FibHeapNode *y, FibHeapNode *x)
434443
}
435444

436445
//-----------------------------------------------------------------------------
437-
void FibHeap::AddToRootList(FibHeapNode *x)
446+
void
447+
FibHeap::AddToRootList(FibHeapNode * x)
438448
{
439449
if (x->m_Mark)
440450
{
@@ -447,7 +457,8 @@ void FibHeap::AddToRootList(FibHeapNode *x)
447457
}
448458

449459
//-----------------------------------------------------------------------------
450-
void FibHeap::Cut(FibHeapNode *x, FibHeapNode *y)
460+
void
461+
FibHeap::Cut(FibHeapNode * x, FibHeapNode * y)
451462
{
452463
if (y->m_Child == x->m_Index)
453464
{
@@ -458,7 +469,7 @@ void FibHeap::Cut(FibHeapNode *x, FibHeapNode *y)
458469
y->m_Child = FibHeapNode::NullNodeIndex;
459470
}
460471

461-
y->m_Degree --;
472+
y->m_Degree--;
462473

463474
m_HeapNodes[x->m_Left].m_Right = x->m_Right;
464475
m_HeapNodes[x->m_Right].m_Left = x->m_Left;
@@ -467,9 +478,10 @@ void FibHeap::Cut(FibHeapNode *x, FibHeapNode *y)
467478
}
468479

469480
//-----------------------------------------------------------------------------
470-
void FibHeap::CascadingCut(FibHeapNode *y)
481+
void
482+
FibHeap::CascadingCut(FibHeapNode * y)
471483
{
472-
FibHeapNode *z = HeapNodeFromIndex(y->m_Parent);
484+
FibHeapNode * z = HeapNodeFromIndex(y->m_Parent);
473485

474486
while (z != nullptr)
475487
{

0 commit comments

Comments
 (0)