gap_map: Replace alloc_mem, free_mem by C++ new, delete

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-06-25 14:33:46 +02:00
parent 20e243d5c9
commit 9b2dc5c25a
2 changed files with 10 additions and 8 deletions

View File

@ -7,8 +7,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "statistc.h"
#include "gap_map.h"
#include "statistc.h"
#include "gap_map.h"
#define EXTERN
EXTERN BOOL_VAR (gapmap_debug, FALSE, "Say which blocks have tables");
@ -79,7 +80,7 @@ GAPMAP::GAPMAP( //Constructor
}
bucket_size = (int16_t) floor (xht_stats.median () + 0.5) / 2;
map_max = (max_right - min_left) / bucket_size;
map = (int16_t *) alloc_mem ((map_max + 1) * sizeof (int16_t));
map = new int16_t[map_max + 1];
for (i = 0; i <= map_max; i++)
map[i] = 0;

View File

@ -7,10 +7,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GAP_MAP_H
#define GAP_MAP_H
#include "blobbox.h"
#ifndef GAP_MAP_H
#define GAP_MAP_H
#include "blobbox.h"
class GAPMAP
{
@ -19,8 +20,7 @@ class GAPMAP
TO_BLOCK *block);
~GAPMAP () { //destructor
if (map != nullptr)
free_mem(map);
delete[] map;
}
bool table_gap( //Is gap a table?
@ -45,4 +45,5 @@ extern BOOL_VAR_H (gapmap_use_ends, FALSE,
extern BOOL_VAR_H (gapmap_no_isolated_quanta, FALSE,
"Ensure gaps not less than 2quanta wide");
extern double_VAR_H (gapmap_big_gaps, 1.75, "xht multiplier");
#endif