19
19
20
20
#include " strngs.h"
21
21
#include < cassert> // for assert
22
+ #include < cstdlib> // for malloc, free
22
23
#include " errcode.h" // for ASSERT_HOST
23
24
#include " genericvector.h" // for GenericVector
24
25
#include " helpers.h" // for ReverseN
25
- #include " memry.h" // for alloc_string, free_string
26
26
#include " serialis.h" // for TFile
27
27
28
28
using tesseract::TFile;
@@ -51,7 +51,7 @@ const int kMaxDoubleSize = 16;
51
51
const int kMinCapacity = 16 ;
52
52
53
53
char * STRING::AllocData (int used, int capacity) {
54
- data_ = (STRING_HEADER *)alloc_string (capacity + sizeof (STRING_HEADER));
54
+ data_ = (STRING_HEADER *)malloc (capacity + sizeof (STRING_HEADER));
55
55
56
56
// header is the metadata for this memory block
57
57
STRING_HEADER* header = GetHeader ();
@@ -61,7 +61,8 @@ char* STRING::AllocData(int used, int capacity) {
61
61
}
62
62
63
63
void STRING::DiscardData () {
64
- free_string ((char *)data_);
64
+ free (data_);
65
+ data_ = nullptr ;
65
66
}
66
67
67
68
// This is a private method; ensure FixHeader is called (or used_ is well defined)
@@ -78,7 +79,7 @@ char* STRING::ensure_cstr(int32_t min_capacity) {
78
79
min_capacity = 2 * orig_header->capacity_ ;
79
80
80
81
int alloc = sizeof (STRING_HEADER) + min_capacity;
81
- STRING_HEADER* new_header = (STRING_HEADER*)(alloc_string (alloc));
82
+ STRING_HEADER* new_header = (STRING_HEADER*)(malloc (alloc));
82
83
83
84
memcpy (&new_header[1 ], GetCStr (), orig_header->used_ );
84
85
new_header->capacity_ = min_capacity;
0 commit comments