@@ -1440,29 +1440,25 @@ static term do_spawn(Context *ctx, Context *new_ctx, size_t arity, size_t n_free
14401440 context_destroy (new_ctx );
14411441 return term_invalid_term ();
14421442 }
1443- ref_data .ref_ticks = globalcontext_get_ref_ticks (ctx -> global );
14441443 struct Monitor * alias_monitor = NULL ;
14451444 if (is_alias ) {
1446- ref_data = (RefData ){
1447- .type = RefTypeProcess ,
1448- .process = { .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), .process_id = ctx -> process_id }
1449- };
1450- alias_monitor = monitor_alias_new (ref_data , alias_type );
1445+ ref_data = (RefData ){ .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), .process_id = ctx -> process_id };
1446+ alias_monitor = monitor_alias_new (& ref_data , alias_type );
14511447 if (IS_NULL_PTR (alias_monitor )) {
14521448 context_destroy (new_ctx );
14531449 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
14541450 }
14551451 } else {
1456- ref_data = (RefData ){ .type = RefTypeShort , . ref_ticks = globalcontext_get_ref_ticks (ctx -> global ) };
1452+ ref_data = (RefData ){ .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), . process_id = INVALID_PROCESS_ID };
14571453 }
14581454
1459- struct Monitor * new_monitor = monitor_new (term_from_local_process_id (ctx -> process_id ), ref_data , false);
1455+ struct Monitor * new_monitor = monitor_new (term_from_local_process_id (ctx -> process_id ), & ref_data , false);
14601456 if (IS_NULL_PTR (new_monitor )) {
14611457 context_destroy (new_ctx );
14621458 free (alias_monitor );
14631459 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
14641460 }
1465- struct Monitor * self_monitor = monitor_new (new_pid , ref_data , true);
1461+ struct Monitor * self_monitor = monitor_new (new_pid , & ref_data , true);
14661462 if (IS_NULL_PTR (self_monitor )) {
14671463 free (alias_monitor );
14681464 free (new_monitor );
@@ -4485,31 +4481,28 @@ static term nif_erlang_monitor(Context *ctx, int argc, term argv[])
44854481 RefData ref_data ;
44864482 struct Monitor * alias_monitor = NULL ;
44874483 if (is_alias ) {
4488- ref_data = (RefData ){
4489- .type = RefTypeProcess ,
4490- .process = { .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), .process_id = ctx -> process_id }
4491- };
4492- alias_monitor = monitor_alias_new (ref_data , alias_type );
4484+ ref_data = (RefData ){ .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), .process_id = ctx -> process_id };
4485+ alias_monitor = monitor_alias_new (& ref_data , alias_type );
44934486 if (IS_NULL_PTR (alias_monitor )) {
44944487 globalcontext_get_process_unlock (ctx -> global , target );
44954488 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
44964489 }
44974490 } else {
4498- ref_data = (RefData ){ .type = RefTypeShort , . ref_ticks = globalcontext_get_ref_ticks (ctx -> global ) };
4491+ ref_data = (RefData ){ .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), . process_id = INVALID_PROCESS_ID };
44994492 }
45004493 struct Monitor * self_monitor ;
45014494 if (term_is_atom (target_proc )) {
4502- self_monitor = monitor_registeredname_monitor_new (local_process_id , target_proc , ref_data );
4495+ self_monitor = monitor_registeredname_monitor_new (local_process_id , target_proc , & ref_data );
45034496 } else {
4504- self_monitor = monitor_new (target_pid , ref_data , true);
4497+ self_monitor = monitor_new (target_pid , & ref_data , true);
45054498 }
45064499 if (IS_NULL_PTR (self_monitor )) {
45074500 globalcontext_get_process_unlock (ctx -> global , target );
45084501 free (alias_monitor );
45094502 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
45104503 }
45114504 term monitoring_pid = term_from_local_process_id (ctx -> process_id );
4512- struct Monitor * other_monitor = monitor_new (monitoring_pid , ref_data , false);
4505+ struct Monitor * other_monitor = monitor_new (monitoring_pid , & ref_data , false);
45134506 if (IS_NULL_PTR (other_monitor )) {
45144507 free (alias_monitor );
45154508 free (self_monitor );
@@ -6695,14 +6688,9 @@ static term nif_erlang_alias(Context *ctx, int argc, term argv[])
66956688 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
66966689 }
66976690
6698- RefData ref_data = {
6699- .type = RefTypeProcess ,
6700- .process = {
6701- .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ),
6702- .process_id = ctx -> process_id }
6703- };
6691+ RefData ref_data = { .ref_ticks = globalcontext_get_ref_ticks (ctx -> global ), .process_id = ctx -> process_id };
67046692 term process_ref = term_from_ref_data (& ref_data , & ctx -> heap );
6705- struct Monitor * monitor = monitor_alias_new (ref_data , ContextMonitorAliasExplicitUnalias );
6693+ struct Monitor * monitor = monitor_alias_new (& ref_data , ContextMonitorAliasExplicitUnalias );
67066694 if (IS_NULL_PTR (monitor )) {
67076695 RAISE_ERROR (OUT_OF_MEMORY_ATOM );
67086696 }
0 commit comments