Skip to content

Commit 5bafd5e

Browse files
committed
Disable the workaround on R < 3.5
On sufficiently old versions of R, #define USE_RINTERNALS would have been sufficient. This gets it to compile on R-3.3.0 and pass test.data.table(); R-3.4.0 is untested but should work in theory.
1 parent 9cecde1 commit 5bafd5e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/R_Defn.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#include <R.h>
22
#include <Rinternals.h>
33

4+
#define SEXPPTR(x) ((SEXP *)DATAPTR(x))
5+
#if R_VERSION >= R_Version(3,5,0)
6+
47
// NOTE: All of this is copied from Defn.h: https://github.com/wch/r-source/blob/28de75af0541f93832c5899139b969d290bf422e/src/include/Defn.h
58
// We intend to gradually remove the need for this header file
69

710
// Writable vector/string pointer
8-
#define SEXPPTR(x) ((SEXP *)DATAPTR(x))
911

1012
#ifndef NAMED_BITS
1113
# define NAMED_BITS 16
@@ -84,3 +86,18 @@ typedef struct {
8486
// SET_GROWABLE_BIT: https://github.com/wch/r-source/blob/2640a203d13473f95c9c7508eb2976fefb5c931c/src/include/Defn.h#L374
8587
#define GROWBLE_MASK ((unsigned short)(1<<5))
8688
#define SET_GROWBLE_BIT(x) (LEVLS(x) |= GROWBLE_MASK)
89+
90+
#else
91+
92+
#define TRULEN TRUELENGTH
93+
#define SET_TRULEN SET_TRUELENGTH
94+
#define STDVEC_TRUELENGTH TRUELENGTH
95+
#define SET_LEN SETLENGTH
96+
#define LEVLS LEVELS
97+
#if R_VERSION >= R_Version(3,4,0)
98+
#define SET_GROWBLE_BIT SET_GROWABLE_BIT
99+
#else
100+
#define SET_GROWBLE_BIT(x)
101+
#endif
102+
103+
#endif

0 commit comments

Comments
 (0)