Skip to content

Commit cd66ce1

Browse files
committed
GH-49529: [R] CI job shows NOTE due to "non-API call" Rf_findVarInFrame (#49530)
### Rationale for this change CI job shows NOTE due to "non-API call" Rf_findVarInFrame ### What changes are included in this PR? Remove non-API calls to doesn't come up on CRAN notes ### Are these changes tested? I'll do some CI testing ### Are there any user-facing changes? No ### AI use Basically all of this, with Claude Opus 4.5 but I did ask multiple questions on the reasoning behind the changes and alternatives - don't understand 100% but looks reasonable to me * GitHub Issue: #49529 Authored-by: Nic Crane <thisisnic@gmail.com> Signed-off-by: Nic Crane <thisisnic@gmail.com>
1 parent 6ddcf43 commit cd66ce1

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

r/src/arrow_cpp11.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@
3939
#define ARROW_R_DCHECK(EXPR)
4040
#endif
4141

42-
#if (R_VERSION < R_Version(3, 5, 0))
43-
#define LOGICAL_RO(x) ((const int*)LOGICAL(x))
44-
#define INTEGER_RO(x) ((const int*)INTEGER(x))
45-
#define REAL_RO(x) ((const double*)REAL(x))
46-
#define COMPLEX_RO(x) ((const Rcomplex*)COMPLEX(x))
47-
#define STRING_PTR_RO(x) ((const SEXP*)STRING_PTR(x))
48-
#define RAW_RO(x) ((const Rbyte*)RAW(x))
49-
#define DATAPTR_RO(x) ((const void*)STRING_PTR(x))
50-
#define DATAPTR(x) (void*)STRING_PTR(x)
51-
#endif
52-
5342
// R_altrep_class_name and R_altrep_class_package don't exist before R 4.6
5443
#if R_VERSION < R_Version(4, 6, 0)
5544
inline SEXP R_altrep_class_name(SEXP x) {
@@ -220,8 +209,12 @@ Pointer r6_to_pointer(SEXP self) {
220209
cpp11::stop("Invalid R object for %s, must be an ArrowObject", type_name.c_str());
221210
}
222211

212+
#if R_VERSION >= R_Version(4, 5, 0)
213+
SEXP xp = R_getVarEx(arrow::r::symbols::xp, self, FALSE, R_UnboundValue);
214+
#else
223215
SEXP xp = Rf_findVarInFrame(self, arrow::r::symbols::xp);
224-
if (xp == R_NilValue) {
216+
#endif
217+
if (xp == R_UnboundValue || xp == R_NilValue) {
225218
cpp11::stop("Invalid: self$`.:xp:.` is NULL");
226219
}
227220

@@ -235,7 +228,11 @@ Pointer r6_to_pointer(SEXP self) {
235228

236229
template <typename T>
237230
void r6_reset_pointer(SEXP r6) {
231+
#if R_VERSION >= R_Version(4, 5, 0)
232+
SEXP xp = R_getVarEx(arrow::r::symbols::xp, r6, FALSE, R_UnboundValue);
233+
#else
238234
SEXP xp = Rf_findVarInFrame(r6, arrow::r::symbols::xp);
235+
#endif
239236
void* p = R_ExternalPtrAddr(xp);
240237
if (p != nullptr) {
241238
delete reinterpret_cast<const std::shared_ptr<T>*>(p);

0 commit comments

Comments
 (0)