@@ -287,9 +287,9 @@ static size_t process_case_structure(
287287 AST_ERB_CONTENT_NODE_T * erb_node = get_erb_content_at (array , index );
288288 if (!erb_node ) { return index ; }
289289
290- hb_array_T * when_conditions = hb_array_init (8 );
291- hb_array_T * in_conditions = hb_array_init (8 );
292- hb_array_T * non_when_non_in_children = hb_array_init (8 );
290+ hb_array_T * when_conditions = hb_array_init (8 , allocator );
291+ hb_array_T * in_conditions = hb_array_init (8 , allocator );
292+ hb_array_T * non_when_non_in_children = hb_array_init (8 , allocator );
293293
294294 analyzed_ruby_T * analyzed = erb_node -> analyzed_ruby ;
295295 bool has_inline_when = has_case_node (analyzed ) && has_when_node (analyzed );
@@ -309,7 +309,7 @@ static size_t process_case_structure(
309309 // Create a synthetic when/in node for inline when/in (e.g., <% case variable when "a" %>),
310310 if (has_inline_when || has_inline_in ) {
311311 hb_array_T * statements = non_when_non_in_children ;
312- non_when_non_in_children = hb_array_init (8 );
312+ non_when_non_in_children = hb_array_init (8 , allocator );
313313
314314 position_T start_position =
315315 erb_node -> tag_closing ? erb_node -> tag_closing -> location .end : erb_node -> content -> location .end ;
@@ -329,7 +329,7 @@ static size_t process_case_structure(
329329 statements ,
330330 start_position ,
331331 end_position ,
332- hb_array_init (0 ),
332+ hb_array_init (0 , allocator ),
333333 allocator
334334 );
335335
@@ -343,7 +343,7 @@ static size_t process_case_structure(
343343 statements ,
344344 start_position ,
345345 end_position ,
346- hb_array_init (0 ),
346+ hb_array_init (0 , allocator ),
347347 allocator
348348 );
349349
@@ -367,7 +367,7 @@ static size_t process_case_structure(
367367 control_type_t next_type = detect_control_type (next_erb );
368368
369369 if (next_type == CONTROL_TYPE_WHEN || next_type == CONTROL_TYPE_IN ) {
370- hb_array_T * statements = hb_array_init (8 );
370+ hb_array_T * statements = hb_array_init (8 , allocator );
371371 index ++ ;
372372 index = process_block_children (node , array , index , statements , context , next_type );
373373
@@ -422,7 +422,7 @@ static size_t process_case_structure(
422422 AST_ERB_CONTENT_NODE_T * next_erb = NULL ;
423423
424424 if (peek_control_type (array , index , & next_type , & next_erb ) && next_type == CONTROL_TYPE_ELSE ) {
425- hb_array_T * else_children = hb_array_init (8 );
425+ hb_array_T * else_children = hb_array_init (8 , allocator );
426426 index ++ ;
427427
428428 index = process_block_children (node , array , index , else_children , context , CONTROL_TYPE_CASE );
@@ -518,7 +518,7 @@ static size_t process_begin_structure(
518518 hb_allocator_T * allocator = context -> allocator ;
519519 AST_ERB_CONTENT_NODE_T * erb_node = get_erb_content_at (array , index );
520520 if (!erb_node ) { return index ; }
521- hb_array_T * children = hb_array_init (8 );
521+ hb_array_T * children = hb_array_init (8 , allocator );
522522
523523 index ++ ;
524524 index = process_block_children (node , array , index , children , context , CONTROL_TYPE_BEGIN );
@@ -537,7 +537,7 @@ static size_t process_begin_structure(
537537 }
538538
539539 if (peek_control_type (array , index , & next_type , & next_erb ) && next_type == CONTROL_TYPE_ELSE ) {
540- hb_array_T * else_children = hb_array_init (8 );
540+ hb_array_T * else_children = hb_array_init (8 , allocator );
541541 index ++ ;
542542
543543 index = process_block_children (node , array , index , else_children , context , CONTROL_TYPE_BEGIN );
@@ -560,7 +560,7 @@ static size_t process_begin_structure(
560560 }
561561
562562 if (peek_control_type (array , index , & next_type , & next_erb ) && next_type == CONTROL_TYPE_ENSURE ) {
563- hb_array_T * ensure_children = hb_array_init (8 );
563+ hb_array_T * ensure_children = hb_array_init (8 , allocator );
564564 index ++ ;
565565
566566 const control_type_t ensure_stop [] = { CONTROL_TYPE_END };
@@ -635,7 +635,7 @@ static size_t process_generic_structure(
635635 hb_allocator_T * allocator = context -> allocator ;
636636 AST_ERB_CONTENT_NODE_T * erb_node = get_erb_content_at (array , index );
637637 if (!erb_node ) { return index ; }
638- hb_array_T * children = hb_array_init (8 );
638+ hb_array_T * children = hb_array_init (8 , allocator );
639639
640640 index ++ ;
641641 index = process_block_children (node , array , index , children , context , initial_type );
@@ -690,7 +690,7 @@ static size_t process_subsequent_block(
690690 if (!erb_node ) { return index ; }
691691
692692 control_type_t type = detect_control_type (erb_node );
693- hb_array_T * children = hb_array_init (8 );
693+ hb_array_T * children = hb_array_init (8 , allocator );
694694
695695 index ++ ;
696696
@@ -772,7 +772,7 @@ static size_t process_block_children(
772772 if (is_terminator_type (parent_type , child_type )) { break ; }
773773
774774 if (is_compound_control_type (child_type )) {
775- hb_array_T * temp_array = hb_array_init (1 );
775+ hb_array_T * temp_array = hb_array_init (1 , context -> allocator );
776776 size_t new_index = process_control_structure (node , array , index , temp_array , context , child_type );
777777
778778 if (hb_array_size (temp_array ) > 0 ) { hb_array_append (children_array , hb_array_first (temp_array )); }
@@ -792,7 +792,7 @@ static size_t process_block_children(
792792
793793hb_array_T * rewrite_node_array (AST_NODE_T * node , hb_array_T * array , analyze_ruby_context_T * context ) {
794794 hb_allocator_T * allocator = context -> allocator ;
795- hb_array_T * new_array = hb_array_init (hb_array_size (array ));
795+ hb_array_T * new_array = hb_array_init (hb_array_size (array ), allocator );
796796 size_t index = 0 ;
797797
798798 while (index < hb_array_size (array )) {
@@ -847,7 +847,7 @@ void herb_analyze_parse_tree(
847847 analyze_ruby_context_T context = {
848848 .document = document ,
849849 .parent = NULL ,
850- .ruby_context_stack = hb_array_init (8 ),
850+ .ruby_context_stack = hb_array_init (8 , allocator ),
851851 .allocator = allocator ,
852852 };
853853
0 commit comments