api: Remove unneeded NULL checks

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2017-04-30 14:38:19 +02:00 committed by Zdenko Podobný
parent 5491a507f4
commit 1efacc4e24

View File

@ -2091,18 +2091,12 @@ void TessBaseAPI::Clear() {
*/ */
void TessBaseAPI::End() { void TessBaseAPI::End() {
Clear(); Clear();
if (thresholder_ != NULL) { delete thresholder_;
delete thresholder_; thresholder_ = NULL;
thresholder_ = NULL; delete page_res_;
} page_res_ = NULL;
if (page_res_ != NULL) { delete block_list_;
delete page_res_; block_list_ = NULL;
page_res_ = NULL;
}
if (block_list_ != NULL) {
delete block_list_;
block_list_ = NULL;
}
if (paragraph_models_ != NULL) { if (paragraph_models_ != NULL) {
paragraph_models_->delete_data_pointers(); paragraph_models_->delete_data_pointers();
delete paragraph_models_; delete paragraph_models_;
@ -2114,30 +2108,18 @@ void TessBaseAPI::End() {
osd_tesseract_ = NULL; osd_tesseract_ = NULL;
tesseract_ = NULL; tesseract_ = NULL;
} }
if (osd_tesseract_ != NULL) { delete osd_tesseract_;
delete osd_tesseract_; osd_tesseract_ = NULL;
osd_tesseract_ = NULL; delete equ_detect_;
} equ_detect_ = NULL;
if (equ_detect_ != NULL) { delete input_file_;
delete equ_detect_; input_file_ = NULL;
equ_detect_ = NULL; delete output_file_;
} output_file_ = NULL;
if (input_file_ != NULL) { delete datapath_;
delete input_file_; datapath_ = NULL;
input_file_ = NULL; delete language_;
} language_ = NULL;
if (output_file_ != NULL) {
delete output_file_;
output_file_ = NULL;
}
if (datapath_ != NULL) {
delete datapath_;
datapath_ = NULL;
}
if (language_ != NULL) {
delete language_;
language_ = NULL;
}
} }
// Clear any library-level memory caches. // Clear any library-level memory caches.