Skip to content

Commit ee7e210

Browse files
authored
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 df9dbbc commit ee7e210

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
@@ -38,17 +38,6 @@
3838
#define ARROW_R_DCHECK(EXPR)
3939
#endif
4040

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

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

@@ -234,7 +227,11 @@ Pointer r6_to_pointer(SEXP self) {
234227

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

0 commit comments

Comments
 (0)