Skip to content

Commit f329939

Browse files
committed
Add missing check and return success/failure. For now, do not use the return value
1 parent f15b0ff commit f329939

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/transform/DivSufSort.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ uint64 DivSufSort::trPartition(int isad, int first, int middle, int last, int v)
16021602
return ((uint64(first) << 32) | (uint64(last) & uint64(0xFFFFFFFF)));
16031603
}
16041604

1605-
void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& budget)
1605+
bool DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& budget)
16061606
{
16071607
const int incr = isad - isa;
16081608
int limit = trIlg(last - first);
@@ -1648,7 +1648,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
16481648
const StackElement* se = _trStack->pop();
16491649

16501650
if (se == nullptr)
1651-
return;
1651+
return false;
16521652

16531653
isad = se->_a;
16541654
first = se->_b;
@@ -1671,7 +1671,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
16711671
const StackElement* se = _trStack->pop();
16721672

16731673
if (se == nullptr)
1674-
return;
1674+
return false;
16751675

16761676
isad = se->_a;
16771677
first = se->_b;
@@ -1685,6 +1685,9 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
16851685
// tandem repeat copy
16861686
const StackElement* se = _trStack->pop();
16871687

1688+
if (se == nullptr)
1689+
return false;
1690+
16881691
if (se->_d == 0) {
16891692
trCopy(isa, first, se->_b, se->_c, last, isad - isa);
16901693
}
@@ -1698,7 +1701,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
16981701
se = _trStack->pop();
16991702

17001703
if (se == nullptr)
1701-
return;
1704+
return false;
17021705

17031706
isad = se->_a;
17041707
first = se->_b;
@@ -1770,7 +1773,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
17701773
const StackElement* se = _trStack->pop();
17711774

17721775
if (se == nullptr)
1773-
return;
1776+
return false;
17741777

17751778
isad = se->_a;
17761779
first = se->_b;
@@ -1784,7 +1787,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
17841787
const StackElement* se = _trStack->pop();
17851788

17861789
if (se == nullptr)
1787-
return;
1790+
return false;
17881791

17891792
isad = se->_a;
17901793
first = se->_b;
@@ -1947,7 +1950,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
19471950
const StackElement* se = _trStack->pop();
19481951

19491952
if (se == nullptr)
1950-
return;
1953+
return false;
19511954

19521955
isad = se->_a;
19531956
first = se->_b;
@@ -1968,7 +1971,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
19681971
const StackElement* se = _trStack->pop();
19691972

19701973
if (se == nullptr)
1971-
return;
1974+
return false;
19721975

19731976
isad = se->_a;
19741977
first = se->_b;
@@ -1991,7 +1994,7 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
19911994
const StackElement* se = _trStack->pop();
19921995

19931996
if (se == nullptr)
1994-
return;
1997+
return false;
19951998

19961999
isad = se->_a;
19972000
first = se->_b;
@@ -2001,6 +2004,8 @@ void DivSufSort::trIntroSort(int isa, int isad, int first, int last, TRBudget& b
20012004
}
20022005
}
20032006
}
2007+
2008+
return true;
20042009
}
20052010

20062011
int DivSufSort::trPivot(const int arr[], int isad, int first, int last) const

src/transform/DivSufSort.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ namespace kanzi
191191

192192
uint64 trPartition(int isad, int first, int middle, int last, int v);
193193

194-
void trIntroSort(int isa, int isad, int first, int last, TRBudget& budget);
194+
bool trIntroSort(int isa, int isad, int first, int last, TRBudget& budget);
195195

196196
int trPivot(const int arr[], int isad, int first, int last) const;
197197

0 commit comments

Comments
 (0)