22// SPDX-License-Identifier: BSD-3-Clause
33#pragma once
44
5- #include < fmindex-collection/string/L0L1_NEPRV9 .h>
5+ #include < fmindex-collection/string/FlattenedBitvectors_L0L1 .h>
66
77extern " C" {
88#include " AwFmIndex.h"
@@ -97,10 +97,10 @@ inline void awFmIndexCreateStringWithRankSupport(struct AwFmIndex* _RESTRICT_ co
9797 }
9898}
9999
100- // If AWFMIndex doesn't implement the correct version, fall back to L0L1NEPRV9 version, which has similar memory usage
100+ // If AWFMIndex doesn't implement the correct version, fall back to FlattenedBitvectors_L0L1 version, which has similar memory usage
101101template <size_t TSigma>
102- struct AWFMIndex : fmc::string::L0L1_NEPRV9 <TSigma, 64 , 65536 > {
103- using fmc::string::L0L1_NEPRV9 <TSigma, 64 , 65536 >::L0L1_NEPRV9 ;
102+ struct AWFMIndex : fmc::string::FlattenedBitvectors_L0L1 <TSigma, 64 , 65536 > {
103+ using fmc::string::FlattenedBitvectors_L0L1 <TSigma, 64 , 65536 >::FlattenedBitvectors_L0L1 ;
104104};
105105/* *
106106 * This is a quick and dirty implementation
@@ -115,7 +115,9 @@ struct AWFMIndex<5> {
115115
116116 AWFMIndex () = default ;
117117 ~AWFMIndex () {
118- if (index == nullptr ) {
118+ if (index != nullptr ) {
119+ // !WORKAROUND !HACK awFmDeallocIndex closes a file handle, even if it didn't open one
120+ index->fileHandle = fopen (" /dev/zero" , " r" );
119121 awFmDeallocIndex (index);
120122 }
121123 }
@@ -225,7 +227,9 @@ struct AWFMIndex<21> {
225227
226228 AWFMIndex () = default ;
227229 ~AWFMIndex () {
228- if (index == nullptr ) {
230+ if (index != nullptr ) {
231+ // !WORKAROUND !HACK awFmDeallocIndex closes a file handle, even if it didn't open one
232+ index->fileHandle = fopen (" /dev/zero" , " r" );
229233 awFmDeallocIndex (index);
230234 }
231235 }
0 commit comments