1use ::rdll::*;
6
7#[inline]
8pub unsafe fn rustr_release_object(x: SEXP) -> SEXP {
9 if x != R_NilValue {
10 R_ReleaseObject(x);
11 }
12 x
13}
14
15
16#[inline]
17pub unsafe fn rustr_preserve_object(x: SEXP) -> SEXP {
18 if x != R_NilValue {
19 R_PreserveObject(x);
20 }
21 x
22}
23
24#[inline]
25pub unsafe fn rustr_replace_object(x: SEXP, y: SEXP) -> SEXP {
26 if Rf_isNull(x) == Rboolean::TRUE {
27 rustr_preserve_object(y);
28 } else if Rf_isNull(y) == Rboolean::TRUE {
29 rustr_release_object(x);
30 } else if x != y {
31 rustr_release_object(x);
36
37 rustr_preserve_object(y);
39
40
41 }
42 y
43}
44
45pub mod stackp;
46pub mod indexp;
47pub mod countp;