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

View File

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