The prefix Rf_ is a common idiom that gives this simple C code a namespace similarity. So you want to look for protect(...) instead of:
/usr/share/R/include/Rinternals.h:#define protect Rf_protect
And considering how this is the "core", you can start with src/main , where a quick grep -c will lead you to src/main/memory.c . Et voila in lines 3075 to 3081
SEXP protect(SEXP s) { if (R_PPStackTop >= R_PPStackSize) R_signal_protect_error(); R_PPStack[R_PPStackTop++] = CHK(s); return s; }
Now that you have said, you probably want to pay attention to most of the file, not just this function.
source share