Skip to main content

R_ProtectWithIndex

Function R_ProtectWithIndex 

Source
pub unsafe fn R_ProtectWithIndex(s: SEXP, index: *mut c_int)
Expand description

Protect a SEXP and record its stack index for later R_Reprotect.

Cost: O(1) — same array write as Rf_protect, plus stores the index. No allocation. Use when you need to replace a protected value in-place (e.g., inside a loop that allocates) without unprotect/re-protect churn. Checked wrapper for R_ProtectWithIndex. Calls R_ProtectWithIndex_unchecked and routes through with_r_thread. Generated from source location line 3851, column 12. Generated from source file miniextendr-api/src/ffi.rs.