Classify: Avoid unneeded new / delete operations

Both class variables BaselineCutoffs and CharNormCutoffs were pointers
to fixed size arrays which were allocated in the constructor and
deallocated in the destructor. These two extra allocations and two
extra deallocations can be avoided.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2017-04-30 14:40:32 +02:00
parent bb75793539
commit 83588bc7a1
2 changed files with 2 additions and 7 deletions

View File

@ -184,9 +184,6 @@ Classify::Classify()
learn_debug_win_ = NULL;
learn_fragmented_word_debug_win_ = NULL;
learn_fragments_debug_win_ = NULL;
CharNormCutoffs = new uinT16[MAX_NUM_CLASSES];
BaselineCutoffs = new uinT16[MAX_NUM_CLASSES];
}
Classify::~Classify() {
@ -194,8 +191,6 @@ Classify::~Classify() {
delete learn_debug_win_;
delete learn_fragmented_word_debug_win_;
delete learn_fragments_debug_win_;
delete[] CharNormCutoffs;
delete[] BaselineCutoffs;
}

View File

@ -529,8 +529,8 @@ class Classify : public CCStruct {
// value in the adaptive classifier. Both are indexed by unichar_id.
// shapetable_cutoffs_ provides a similar value for each shape in the
// shape_table_
uinT16* CharNormCutoffs;
uinT16* BaselineCutoffs;
uinT16 CharNormCutoffs[MAX_NUM_CLASSES];
uinT16 BaselineCutoffs[MAX_NUM_CLASSES];
GenericVector<uinT16> shapetable_cutoffs_;
ScrollView* learn_debug_win_;
ScrollView* learn_fragmented_word_debug_win_;