mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-18 03:19:15 +08:00
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:
parent
bb75793539
commit
83588bc7a1
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user