@@ -285,7 +285,7 @@ test "zflecs.basic" {
285285const Eats = struct {};
286286const Apples = struct {};
287287
288- fn move (it : * ecs.iter_t ) callconv (.C ) void {
288+ fn move (it : * ecs.iter_t ) callconv (.c ) void {
289289 const p = ecs .field (it , Position , 0 ).? ;
290290 const v = ecs .field (it , Velocity , 1 ).? ;
291291
@@ -477,27 +477,20 @@ test "zflecs.struct-dtor-hook" {
477477 defer _ = ecs .fini (world );
478478
479479 const Chat = struct {
480- messages : std .ArrayList ([]const u8 ),
481-
482- pub fn init (allocator : std.mem.Allocator ) @This () {
483- return @This (){
484- .messages = std .ArrayList ([]const u8 ).init (allocator ),
485- };
486- }
487-
488- pub fn dtor (self : @This ()) void {
489- self .messages .deinit ();
480+ messages : std .ArrayList ([]const u8 ) = .{},
481+ pub fn dtor (self : * @This ()) void {
482+ self .messages .deinit (std .testing .allocator );
490483 }
491484 };
492485
493486 ecs .COMPONENT (world , Chat );
494487 {
495488 var system_desc = ecs.system_desc_t {};
496489 system_desc .callback = struct {
497- pub fn chatSystem (it : * ecs.iter_t ) callconv (.C ) void {
490+ pub fn chatSystem (it : * ecs.iter_t ) callconv (.c ) void {
498491 const chat_components = ecs .field (it , Chat , 0 ).? ;
499492 for (0.. it .count ()) | i | {
500- chat_components [i ].messages .append ("some words hi" ) catch @panic ("whomp" );
493+ chat_components [i ].messages .append (std . testing . allocator , "some words hi" ) catch @panic ("whomp" );
501494 }
502495 }
503496 }.chatSystem ;
@@ -506,7 +499,7 @@ test "zflecs.struct-dtor-hook" {
506499 }
507500
508501 const chat_entity = ecs .new_entity (world , "Chat entity" );
509- _ = ecs .set (world , chat_entity , Chat , Chat . init ( std . testing . allocator ) );
502+ _ = ecs .set (world , chat_entity , Chat , Chat {} );
510503
511504 _ = ecs .progress (world , 0 );
512505
@@ -517,7 +510,7 @@ test "zflecs.struct-dtor-hook" {
517510 // commented out since the cleanup is never called to free the ArrayList
518511 // memory.
519512}
520- fn module (world : * ecs.world_t ) callconv (.C ) void {
513+ fn module (world : * ecs.world_t ) callconv (.c ) void {
521514 var desc = ecs.component_desc_t { .entity = 0 , .type = .{ .size = 0 , .alignment = 0 } };
522515 _ = ecs .module_init (world , "SimpleModule" , & desc );
523516
0 commit comments