sentencepiece/fix_of_an_unattainable_condition.patch
2021-11-02 15:50:59 +08:00

23 lines
1.1 KiB
Diff

diff --git a/third_party/esaxx/sais.hxx b/third_party/esaxx/sais.hxx
index f1702f8..b9071c8 100644
--- a/third_party/esaxx/sais.hxx
+++ b/third_party/esaxx/sais.hxx
@@ -179,7 +179,7 @@ typedef typename std::iterator_traits<string_type>::value_type char_type;
sort all the S-substrings */
if(fs < (maxthreads * k)) {
index_type *C, *B;
- if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ C = new index_type[maxthreads * k];
B = (1 < maxthreads) ? C + k : C;
getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
#ifdef _OPENMP
@@ -271,7 +271,7 @@ typedef typename std::iterator_traits<string_type>::value_type char_type;
/* stage 3: induce the result for the original problem */
if(fs < (maxthreads * k)) {
index_type *B, *C;
- if((C = new index_type[maxthreads * k]) == 0) { return -2; }
+ C = new index_type[maxthreads * k];
B = (1 < maxthreads) ? C + k : C;
/* put all left-most S characters into their buckets */
getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */