Skip to content

Commit fadbd88

Browse files
committed
Remove usage of STRING_PTR() in favor of STRING_PTR_RO()
Now that we require R >=3.6, we can be sure it is there. Also unconditionally using `DATAPTR_RO()` for `r_list_deref_const()` now, at least until we officially have access to `VECTOR_PTR_RO()`.
1 parent 2e22751 commit fadbd88

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# clock (development version)
22

3+
* Removed usage of non-API `STRING_PTR()` in favor of `STRING_PTR_RO()`.
4+
35
* Fixed a gcc warning reported by CRAN related to templated C++ constructors
46
(#371).
57

src/utils.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,15 @@ static
110110
inline
111111
const SEXP*
112112
r_chr_deref_const(SEXP x) {
113-
return (const SEXP*) STRING_PTR(x);
113+
return STRING_PTR_RO(x);
114114
}
115115

116116
static
117117
inline
118118
const SEXP*
119119
r_list_deref_const(SEXP x) {
120-
#if (R_VERSION < R_Version(3, 5, 0))
121-
return ((const SEXP*) STRING_PTR(x));
122-
#else
123-
return ((const SEXP*) DATAPTR_RO(x));
124-
#endif
120+
// TODO: Use `VECTOR_PTR_RO()` in R >=4.5.0 after it is released
121+
return (const SEXP*) DATAPTR_RO(x);
125122
}
126123

127124
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)