From 2bbb8d24bc2fa30e678fcfc41107c8f8a04e71c8 Mon Sep 17 00:00:00 2001 From: Greg Lin Date: Mon, 6 Jan 2025 13:30:28 -0600 Subject: [PATCH] Fix tests for R-devel, switch to public R API functions --- test/testpkg/src/add.c | 4 ++-- test/testpkg/src/subtract.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/testpkg/src/add.c b/test/testpkg/src/add.c index 77cd5f3..1bc5036 100644 --- a/test/testpkg/src/add.c +++ b/test/testpkg/src/add.c @@ -3,8 +3,8 @@ SEXP add(SEXP a, SEXP b) { - SEXP result = PROTECT(allocVector(REALSXP, 1)); - REAL(result)[0] = asReal(a) + asReal(b); + SEXP result = PROTECT(Rf_allocVector(REALSXP, 1)); + REAL(result)[0] = Rf_asReal(a) + Rf_asReal(b); UNPROTECT(1); return result; } diff --git a/test/testpkg/src/subtract.cpp b/test/testpkg/src/subtract.cpp index c9ef0a1..175043d 100644 --- a/test/testpkg/src/subtract.cpp +++ b/test/testpkg/src/subtract.cpp @@ -3,8 +3,8 @@ extern "C" SEXP subtract(SEXP a, SEXP b) { - SEXP result = PROTECT(allocVector(REALSXP, 1)); - REAL(result)[0] = asReal(a) - asReal(b); + SEXP result = PROTECT(Rf_allocVector(REALSXP, 1)); + REAL(result)[0] = Rf_asReal(a) - Rf_asReal(b); UNPROTECT(1); return result; }