From 83588bc7a18e50fb435b5ca8a45fd7e00ab2ccdf Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 30 Apr 2017 14:40:32 +0200 Subject: [PATCH] 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 --- classify/classify.cpp | 5 ----- classify/classify.h | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/classify/classify.cpp b/classify/classify.cpp index 7c11c51f6..57fd609c6 100644 --- a/classify/classify.cpp +++ b/classify/classify.cpp @@ -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; } diff --git a/classify/classify.h b/classify/classify.h index c04cb93c4..62086c400 100644 --- a/classify/classify.h +++ b/classify/classify.h @@ -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 shapetable_cutoffs_; ScrollView* learn_debug_win_; ScrollView* learn_fragmented_word_debug_win_;