{
v->width = si->sir.width + 1;
v->height = si->sir.height + 1;
- v->bitmap = malloc(v->width * v->height * sizeof(bool));
+ v->bitmap = xmalloc(v->width * v->height * sizeof(bool));
for (int i=0; i<v->width*v->height; i++) v->bitmap[i] = 1;
}
void make_bitmap_point(struct variant *v, struct sym_point *sp)
{
v->width = v->height = sp->size + 1;
- v->bitmap = malloc(v->width * v->height * sizeof(bool));
+ v->bitmap = xmalloc(v->width * v->height * sizeof(bool));
// FIXME: Okay, memset would be much nicer here
for (int i=0; i<sp->size*sp->size; i++) v->bitmap[i] = 1;
}
v->width = max_x - min_x + 1;
v->height = max_y - min_y + 1;
- v->bitmap = malloc(v->width * v->height * sizeof(bool));
+ v->bitmap = xmalloc(v->width * v->height * sizeof(bool));
memset(v->bitmap, 0, v->width * v->height * sizeof(bool));
for (int i=0; i<th; i++)
if (dbg_segments >= VERBOSITY_PLACEMENT)
printf("Cutting [%.2f; %.2f] -- [%.2f; %.2f] to dist %.2f\n", e->n1->o->x, e->n1->o->y, e->n2->o->x, e->n2->o->y, dist);
- struct graph_edge *new = malloc(sizeof(struct graph_edge));
+ struct graph_edge *new = xmalloc(sizeof(struct graph_edge));
*new = *e;
e->next = new;
switch (e->label->type)
{
case SYMBOLIZER_TEXT:
- new->label = malloc(sizeof(struct sym_text));
+ new->label = xmalloc(sizeof(struct sym_text));
*((struct sym_text *) new->label) = *((struct sym_text *) e->label);
break;
default:
return;
}
- struct osm_node *n11 = malloc(sizeof(struct osm_node));
- struct graph_node *gn = malloc(sizeof(struct graph_node));
+ struct osm_node *n11 = xmalloc(sizeof(struct osm_node));
+ struct graph_node *gn = xmalloc(sizeof(struct graph_node));
gn->o = n11;
double vsize = sqrt(pow(n1->x - n2->x, 2) + pow(n1->y - n2->y, 2));
n11->x = n1->x + (n2->x - n1->x) / vsize * dist;
}
rs = make_new_segment(rls, NULL);
- rs->label = malloc(sizeof(struct sym_text));
+ rs->label = xmalloc(sizeof(struct sym_text));
*((struct sym_text *) rs->label) = *((struct sym_text *) e->label);
rs->x1 = e->n1->o->x;
void dump_bitmaps(struct individual *individual)
{
- bool *bitmap = malloc(page_width_int * page_height_int * sizeof(bool));
+ bool *bitmap = xmalloc(page_width_int * page_height_int * sizeof(bool));
printf("Bitmap size is %d\n", page_width_int * page_height_int);
for (int i=0; i<page_height_int; i++)
for (int j=0; j<page_width_int; j++)
struct individual **perform_crossover(struct individual *parent1, struct individual *parent2)
{
- struct individual **buffer = malloc(2*sizeof(struct individual));
+ struct individual **buffer = xmalloc(2*sizeof(struct individual));
struct individual *child1 = ep_alloc(ep_individuals); init_individual(child1);
struct individual *child2 = ep_alloc(ep_individuals); init_individual(child2);
for (uns i=0; i<GARY_SIZE(parts); i++)
{
- struct map_placement *mp = malloc(sizeof(struct map_placement));
+ struct map_placement *mp = xmalloc(sizeof(struct map_placement));
mp->placement = p;
mp->part = parts[i];
{
struct placement **closure;
GARY_INIT(closure, 0);
- bool *chosen = malloc(GARY_SIZE(placement->individual->placements) * sizeof(bool));
+ bool *chosen = xmalloc(GARY_SIZE(placement->individual->placements) * sizeof(bool));
for (uns i=0; i<GARY_SIZE(placement->individual->placements); i++) { chosen[i] = 0; }
chosen[placement->request->ind] = 1;
}
free(i->map[j]);
- struct map_part *part = malloc(sizeof(struct map_part));
+ struct map_part *part = xmalloc(sizeof(struct map_part));
part->ind = j;
- mp = malloc(sizeof(struct map_placement));
+ mp = xmalloc(sizeof(struct map_placement));
part->placement = mp;
mp->placement = &dummy_placement;
mp->next_in_map = mp->prev_in_map = NULL;
for (uns j=0; j<num_map_parts; j++)
{
GARY_PUSH(individual->map);
- struct map_part *part = malloc(sizeof(struct map_part));
- struct map_placement *mp = malloc(sizeof(struct map_placement));
+ struct map_part *part = xmalloc(sizeof(struct map_part));
+ struct map_placement *mp = xmalloc(sizeof(struct map_placement));
part->placement = mp;
part->ind = j;
mp->placement = &dummy_placement;