MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / free_ref

Method free_ref

Source/Utils/dukglue/dukvalue.h:529–543  ·  view source on GitHub ↗

remove ref_array_idx from the ref array and add its spot to the free list (at refs[0])

Source from the content-addressed store, hash-verified

527
528 // remove ref_array_idx from the ref array and add its spot to the free list (at refs[0])
529 static void free_ref(duk_context* ctx, duk_uarridx_t ref_array_idx)
530 {
531 push_ref_array(ctx);
532
533 // add this spot to the free list
534 // refs[old_obj_idx] = refs[0] (implicitly gives up our reference)
535 duk_get_prop_index(ctx, -1, 0);
536 duk_put_prop_index(ctx, -2, ref_array_idx);
537
538 // refs[0] = old_obj_idx
539 duk_push_uint(ctx, ref_array_idx);
540 duk_put_prop_index(ctx, -2, 0);
541
542 duk_pop(ctx); // pop ref array
543 }
544
545 // this is for reference counting - used to release our reference based on the state
546 // of mRefCount. If mRefCount is NULL, we never got copy constructed, so we have ownership

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected