Merge pull request #914 from stweil/clean

Clean code
This commit is contained in:
zdenop 2017-05-13 12:45:57 +02:00 committed by GitHub
commit 29f3de9be1
2 changed files with 9 additions and 11 deletions

View File

@ -2064,12 +2064,10 @@ void TessBaseAPI::End() {
delete paragraph_models_;
paragraph_models_ = NULL;
}
if (tesseract_ != NULL) {
delete tesseract_;
if (osd_tesseract_ == tesseract_)
osd_tesseract_ = NULL;
tesseract_ = NULL;
}
if (osd_tesseract_ == tesseract_)
osd_tesseract_ = nullptr;
delete tesseract_;
tesseract_ = nullptr;
delete osd_tesseract_;
osd_tesseract_ = NULL;
delete equ_detect_;

View File

@ -1009,13 +1009,13 @@ int UNICHARSET::add_script(const char* script) {
if (script_table_size_reserved == 0) {
script_table_size_reserved = 8;
script_table = new char*[script_table_size_reserved];
}
if (script_table_size_used + 1 >= script_table_size_reserved) {
char** new_script_table = new char*[script_table_size_reserved * 2];
memcpy(new_script_table, script_table, script_table_size_reserved * sizeof(char*));
} else if (script_table_size_used >= script_table_size_reserved) {
assert(script_table_size_used == script_table_size_reserved);
script_table_size_reserved += script_table_size_reserved;
char** new_script_table = new char*[script_table_size_reserved];
memcpy(new_script_table, script_table, script_table_size_used * sizeof(char*));
delete[] script_table;
script_table = new_script_table;
script_table_size_reserved = 2 * script_table_size_reserved;
}
script_table[script_table_size_used] = new char[strlen(script) + 1];
strcpy(script_table[script_table_size_used], script);