Skip to content

Commit

Permalink
gap_map: Replace alloc_mem, free_mem by C++ new, delete
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jun 25, 2018
1 parent 20e243d commit 9b2dc5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/textord/gap_map.cpp
Expand Up @@ -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");
Expand Down Expand Up @@ -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;

Expand Down
11 changes: 6 additions & 5 deletions src/textord/gap_map.h
Expand Up @@ -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
{
Expand All @@ -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?
Expand All @@ -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

0 comments on commit 9b2dc5c

Please sign in to comment.