@@ -335,7 +335,7 @@ static void free_pb_type(t_pb_type* pb_type) {
335335 for (int m = 0 ; m < pb_type->modes [i].interconnect [j].annotations [k].num_value_prop_pairs ; ++m) {
336336 vtr::free (pb_type->modes [i].interconnect [j].annotations [k].value [m]);
337337 }
338- vtr::free ( pb_type->modes [i].interconnect [j].annotations [k].prop ) ;
338+ delete[] pb_type->modes [i].interconnect [j].annotations [k].prop ;
339339 vtr::free (pb_type->modes [i].interconnect [j].annotations [k].value );
340340 }
341341 vtr::free (pb_type->modes [i].interconnect [j].annotations );
@@ -355,7 +355,7 @@ static void free_pb_type(t_pb_type* pb_type) {
355355 vtr::free (pb_type->annotations [i].value [j]);
356356 }
357357 vtr::free (pb_type->annotations [i].value );
358- vtr::free ( pb_type->annotations [i].prop ) ;
358+ delete[] pb_type->annotations [i].prop ;
359359 if (pb_type->annotations [i].input_pins ) {
360360 vtr::free (pb_type->annotations [i].input_pins );
361361 }
@@ -367,7 +367,7 @@ static void free_pb_type(t_pb_type* pb_type) {
367367 }
368368 }
369369 if (pb_type->num_annotations > 0 ) {
370- vtr::free ( pb_type->annotations ) ;
370+ delete[] pb_type->annotations ;
371371 }
372372
373373 if (pb_type->pb_type_power ) {
@@ -527,7 +527,7 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
527527 }
528528 }
529529
530- copy->annotations = ( t_pin_to_pin_annotation*) vtr::calloc ( pb_type->num_annotations , sizeof (t_pin_to_pin_annotation) );
530+ copy->annotations = new t_pin_to_pin_annotation[ pb_type->num_annotations ]( );
531531 copy->num_annotations = pb_type->num_annotations ;
532532 for (i = 0 ; i < copy->num_annotations ; i++) {
533533 copy->annotations [i].clock = vtr::strdup (pb_type->annotations [i].clock );
@@ -549,7 +549,7 @@ void alloc_and_load_default_child_for_pb_type(t_pb_type* pb_type,
549549 copy->annotations [i].format = pb_type->annotations [i].format ;
550550 copy->annotations [i].type = pb_type->annotations [i].type ;
551551 copy->annotations [i].num_value_prop_pairs = pb_type->annotations [i].num_value_prop_pairs ;
552- copy->annotations [i].prop = ( int *) vtr::malloc ( sizeof ( int ) * pb_type->annotations [i].num_value_prop_pairs ) ;
552+ copy->annotations [i].prop = new int [ pb_type->annotations [i].num_value_prop_pairs ] ;
553553 copy->annotations [i].value = (char **)vtr::malloc (sizeof (char *) * pb_type->annotations [i].num_value_prop_pairs );
554554 for (j = 0 ; j < pb_type->annotations [i].num_value_prop_pairs ; j++) {
555555 copy->annotations [i].prop [j] = pb_type->annotations [i].prop [j];
@@ -627,8 +627,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
627627 lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].format = lut_pb_type->annotations [i].format ;
628628 lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].type = lut_pb_type->annotations [i].type ;
629629 lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].num_value_prop_pairs = lut_pb_type->annotations [i].num_value_prop_pairs ;
630- lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].prop = (int *)vtr::malloc (sizeof (int )
631- * lut_pb_type->annotations [i].num_value_prop_pairs );
630+ lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].prop = new int [lut_pb_type->annotations [i].num_value_prop_pairs ];
632631 lut_pb_type->modes [0 ].interconnect [0 ].annotations [i].value = (char **)vtr::malloc (sizeof (char *)
633632 * lut_pb_type->annotations [i].num_value_prop_pairs );
634633 for (j = 0 ; j < lut_pb_type->annotations [i].num_value_prop_pairs ; j++) {
@@ -654,7 +653,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
654653 free (lut_pb_type->annotations [i].value [j]);
655654 }
656655 free (lut_pb_type->annotations [i].value );
657- free ( lut_pb_type->annotations [i].prop ) ;
656+ delete[] lut_pb_type->annotations [i].prop ;
658657 if (lut_pb_type->annotations [i].input_pins ) {
659658 free (lut_pb_type->annotations [i].input_pins );
660659 }
@@ -666,7 +665,7 @@ void ProcessLutClass(t_pb_type* lut_pb_type) {
666665 }
667666 }
668667 lut_pb_type->num_annotations = 0 ;
669- free ( lut_pb_type->annotations ) ;
668+ delete[] lut_pb_type->annotations ;
670669 lut_pb_type->annotations = nullptr ;
671670 lut_pb_type->modes [1 ].pb_type_children [0 ].depth = lut_pb_type->depth + 1 ;
672671 lut_pb_type->modes [1 ].pb_type_children [0 ].parent_mode = &lut_pb_type->modes [1 ];
@@ -944,7 +943,7 @@ void SyncModelsPbTypes_rec(t_arch* arch,
944943
945944 pb_type->model_id = model_match_prim_id;
946945 vtr::t_linked_vptr* old = model_match_prim.pb_types ;
947- model_match_prim.pb_types = ( vtr::t_linked_vptr*) vtr::malloc ( sizeof (vtr::t_linked_vptr)) ;
946+ model_match_prim.pb_types = new vtr::t_linked_vptr;
948947 model_match_prim.pb_types ->next = old;
949948 model_match_prim.pb_types ->data_vptr = pb_type;
950949
0 commit comments