coutln: Replace alloc_mem, free_mem by standard functions

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-06-25 14:27:35 +02:00
parent b6eb22ccfb
commit f99be62c4c
2 changed files with 8 additions and 15 deletions

View File

@ -64,8 +64,7 @@ C_OUTLINE::C_OUTLINE(CRACKEDGE* startpt, ICOORD bot_left, ICOORD top_right,
return;
}
//get memory
steps = (uint8_t *) alloc_mem (step_mem());
memset(steps, 0, step_mem());
steps = (uint8_t *)calloc(step_mem(), 1);
edgept = startpt;
for (stepindex = 0; stepindex < length; stepindex++) {
@ -98,8 +97,7 @@ int16_t length //length of loop
pos = startpt;
stepcount = length; // No. of steps.
ASSERT_HOST(length >= 0);
steps = static_cast<uint8_t*>(alloc_mem(step_mem())); // Get memory.
memset(steps, 0, step_mem());
steps = static_cast<uint8_t*>(calloc(step_mem(), 1)); // Get memory.
lastdir = new_steps[length - 1];
prevdir = lastdir;
@ -162,8 +160,7 @@ C_OUTLINE::C_OUTLINE(C_OUTLINE* srcline, FCOORD rotation) : offsets(nullptr) {
return;
}
//get memory
steps = (uint8_t *) alloc_mem (step_mem());
memset(steps, 0, step_mem());
steps = (uint8_t *)calloc(step_mem(), 1);
for (int iteration = 0; iteration < 2; ++iteration) {
DIR128 round1 = iteration == 0 ? 32 : 0;
@ -1014,10 +1011,9 @@ void C_OUTLINE::plot_normed(const DENORM& denorm, ScrollView::Color colour,
C_OUTLINE& C_OUTLINE::operator=(const C_OUTLINE& source) {
box = source.box;
start = source.start;
if (steps != nullptr)
free_mem(steps);
free(steps);
stepcount = source.stepcount;
steps = (uint8_t *) alloc_mem (step_mem());
steps = (uint8_t *)malloc(step_mem());
memmove (steps, source.steps, step_mem());
if (!children.empty ())
children.clear ();

View File

@ -24,7 +24,6 @@
#include "bits16.h" // for BITS16
#include "elst.h" // for ELIST_ITERATOR, ELISTIZEH, ELIST_LINK
#include "ipoints.h" // for operator+=
#include "memry.h" // for free_mem
#include "mod128.h" // for DIR128, DIRBITS
#include "platform.h" // for DLLSYM
#include "points.h" // for ICOORD, FCOORD
@ -92,9 +91,7 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
static void FakeOutline(const TBOX& box, C_OUTLINE_LIST* outlines);
~C_OUTLINE () { //destructor
if (steps != nullptr)
free_mem(steps);
steps = nullptr;
free(steps);
delete [] offsets;
}
@ -286,9 +283,9 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
TBOX box; // bounding box
ICOORD start; // start coord
int16_t stepcount; // no of steps
int16_t stepcount; // no of steps
BITS16 flags; // flags about outline
uint8_t *steps; // step array
uint8_t *steps; // step array
EdgeOffset* offsets; // Higher precision edge.
C_OUTLINE_LIST children; // child elements
static ICOORD step_coords[4];