Merge pull request #58 from apache/kll_minor_cleanup
KLL sketch minor cleanup and more tests
diff --git a/cpc/src/fm85.cpp b/cpc/src/fm85.cpp
index e7544e4..1055fb1 100644
--- a/cpc/src/fm85.cpp
+++ b/cpc/src/fm85.cpp
@@ -61,20 +61,22 @@
// This is to support custom allocator and deallocator
void fm85InitAD (void* (*alloc)(size_t), void (*dealloc)(void*)) {
if (!fm85Initialized) {
- fm85Initialized = 1;
fm85alloc = alloc;
fm85free = dealloc;
fillByteLeadingZerosTable();
fillByteTrailingZerosTable();
makeTheDecodingTables();
- fillInvPow2Tab ();
- fillKxpByteLookup ();
+ fillInvPow2Tab();
+ fillKxpByteLookup();
+ fm85Initialized = 1;
}
}
void fm85Clean (void) {
- freeTheDecodingTables();
- fm85Initialized = 0;
+ if (fm85Initialized) {
+ freeTheDecodingTables();
+ fm85Initialized = 0;
+ }
}
/*******************************************************/