Skip to content

Commit 3256475

Browse files
committed
changed calloc to new
1 parent e8875c7 commit 3256475

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

libs/libarchfpga/src/arch_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void free_pb_type(t_pb_type* pb_type) {
354354
}
355355
}
356356
if (pb_type->num_annotations > 0) {
357-
vtr::free(pb_type->annotations);
357+
delete[] pb_type->annotations;
358358
}
359359

360360
if (pb_type->pb_type_power) {
@@ -512,7 +512,7 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
512512
}
513513
}
514514

515-
copy->annotations = (t_pin_to_pin_annotation*)vtr::calloc(pb_type->num_annotations, sizeof(t_pin_to_pin_annotation));
515+
copy->annotations = new t_pin_to_pin_annotation[pb_type->num_annotations]();
516516
copy->num_annotations = pb_type->num_annotations;
517517
for (i = 0; i < copy->num_annotations; i++) {
518518
copy->annotations[i].clock = vtr::strdup(pb_type->annotations[i].clock);
@@ -630,7 +630,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
630630
}
631631
}
632632
lut_pb_type->num_annotations = 0;
633-
vtr::free(lut_pb_type->annotations);
633+
delete[] lut_pb_type->annotations;
634634
lut_pb_type->annotations = nullptr;
635635
lut_pb_type->modes[1].pb_type_children[0].depth = lut_pb_type->depth + 1;
636636
lut_pb_type->modes[1].pb_type_children[0].parent_mode = &lut_pb_type->modes[1];

libs/libarchfpga/src/physical_types.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,16 @@ struct t_pin_to_pin_annotation {
12621262

12631263
int line_num; /* used to report what line number this annotation is found in architecture file */
12641264

1265-
t_pin_to_pin_annotation() = default;
1265+
t_pin_to_pin_annotation() {
1266+
pairs = std::vector<std::pair<int, std::string>>();
1267+
input_pins = nullptr;
1268+
output_pins = nullptr;
1269+
clock = nullptr;
1270+
1271+
line_num = 0;
1272+
type = (e_pin_to_pin_annotation_type) 0;
1273+
format = (e_pin_to_pin_annotation_format) 0;
1274+
}
12661275
};
12671276

12681277
/*************************************************************************************************

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,8 @@ static void ProcessPb_Type(pugi::xml_node Parent,
13711371
num_annotations += count_children(Parent, child_name, loc_data, ReqOpt::OPTIONAL);
13721372
}
13731373

1374-
pb_type->annotations = (t_pin_to_pin_annotation*)vtr::calloc(num_annotations, sizeof(t_pin_to_pin_annotation));
1374+
pb_type->annotations = new t_pin_to_pin_annotation[num_annotations]();
1375+
13751376
pb_type->num_annotations = num_annotations;
13761377

13771378
int annotation_idx = 0;

0 commit comments

Comments
 (0)