Skip to content

Commit 40b92d1

Browse files
committed
Move the resizable allocation functions to utils.c
1 parent 7395eb1 commit 40b92d1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/data.table.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,7 @@
8989

9090
// TODO(R>=4.6.0): remove the SVN revision check
9191
#if R_VERSION < R_Version(4, 6, 0) || R_SVN_REVISION < 89077
92-
static inline SEXP R_allocResizableVector_(SEXPTYPE type, R_xlen_t maxlen) {
93-
SEXP ret = allocVector(type, maxlen);
94-
SET_TRUELENGTH(ret, maxlen);
95-
SET_GROWABLE_BIT(ret);
96-
return ret;
97-
}
9892
# define R_allocResizableVector(type, maxlen) R_allocResizableVector_(type, maxlen)
99-
static inline SEXP R_duplicateAsResizable_(SEXP x) {
100-
SEXP ret = duplicate(x);
101-
SET_TRUELENGTH(ret, xlength(ret));
102-
SET_GROWABLE_BIT(ret);
103-
return ret;
104-
}
10593
# define R_duplicateAsResizable(x) R_duplicateAsResizable_(x)
10694
# define R_resizeVector(x, newlen) SETLENGTH(x, newlen)
10795
# define R_maxLength(x) TRUELENGTH(x)
@@ -347,6 +335,8 @@ bool perhapsDataTable(SEXP x);
347335
SEXP perhapsDataTableR(SEXP x);
348336
SEXP frev(SEXP x, SEXP copyArg);
349337
NORET void internal_error(const char *call_name, const char *format, ...);
338+
SEXP R_allocResizableVector_(SEXPTYPE type, R_xlen_t maxlen);
339+
SEXP R_duplicateAsResizable_(SEXP x);
350340

351341
// types.c
352342
char *end(char *start);

src/utils.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,17 @@ void internal_error(const char *call_name, const char *format, ...) {
659659

660660
error("%s %s: %s. %s", _("Internal error in"), call_name, buff, _("Please report to the data.table issues tracker."));
661661
}
662+
663+
SEXP R_allocResizableVector_(SEXPTYPE type, R_xlen_t maxlen) {
664+
SEXP ret = allocVector(type, maxlen);
665+
SET_TRUELENGTH(ret, maxlen);
666+
SET_GROWABLE_BIT(ret);
667+
return ret;
668+
}
669+
670+
SEXP R_duplicateAsResizable_(SEXP x) {
671+
SEXP ret = duplicate(x);
672+
SET_TRUELENGTH(ret, xlength(ret));
673+
SET_GROWABLE_BIT(ret);
674+
return ret;
675+
}

0 commit comments

Comments
 (0)