Skip to content

Commit 47f5fb3

Browse files
authored
Further C level cleanups (#166)
* Revert inlining later2() * Move static inlines to header
1 parent b07703f commit 47f5fb3

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

src/core.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -208,37 +208,6 @@ void tls_finalizer(SEXP xptr) {
208208

209209
}
210210

211-
#if R_VERSION < R_Version(4, 1, 0)
212-
213-
inline SEXP R_NewEnv(SEXP parent, int hash, int size) {
214-
(void) parent;
215-
(void) hash;
216-
(void) size;
217-
return Rf_allocSExp(ENVSXP);
218-
}
219-
220-
#endif
221-
222-
#if R_VERSION < R_Version(4, 5, 0)
223-
224-
inline SEXP R_mkClosure(SEXP formals, SEXP body, SEXP env) {
225-
SEXP fun = Rf_allocSExp(CLOSXP);
226-
SET_FORMALS(fun, formals);
227-
SET_BODY(fun, body);
228-
SET_CLOENV(fun, env);
229-
return fun;
230-
}
231-
232-
#endif
233-
234-
inline void later2(void (*fun)(void *), void *data) {
235-
eln2(fun, data, 0, 0);
236-
}
237-
238-
inline int nano_integer(const SEXP x) {
239-
return (TYPEOF(x) == INTSXP || TYPEOF(x) == LGLSXP) ? NANO_INTEGER(x) : Rf_asInteger(x);
240-
}
241-
242211
SEXP mk_error(const int xc) {
243212

244213
SEXP err = Rf_ScalarInteger(xc);

src/nanonext.h

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,41 @@ extern SEXP nano_success;
280280
extern SEXP nano_unresolved;
281281

282282
#if R_VERSION < R_Version(4, 1, 0)
283-
SEXP R_NewEnv(SEXP, int, int);
283+
284+
static inline SEXP R_NewEnv(SEXP parent, int hash, int size) {
285+
(void) parent;
286+
(void) hash;
287+
(void) size;
288+
return Rf_allocSExp(ENVSXP);
289+
}
290+
284291
#endif
292+
285293
#if R_VERSION < R_Version(4, 5, 0)
286-
SEXP R_mkClosure(SEXP, SEXP, SEXP);
294+
295+
static inline SEXP R_mkClosure(SEXP formals, SEXP body, SEXP env) {
296+
SEXP fun = Rf_allocSExp(CLOSXP);
297+
SET_FORMALS(fun, formals);
298+
SET_BODY(fun, body);
299+
SET_CLOENV(fun, env);
300+
return fun;
301+
}
302+
287303
#endif
304+
305+
static inline int nano_integer(const SEXP x) {
306+
return (TYPEOF(x) == INTSXP || TYPEOF(x) == LGLSXP) ? NANO_INTEGER(x) : Rf_asInteger(x);
307+
}
308+
309+
static inline void later2(void (*fun)(void *), void *data) {
310+
eln2(fun, data, 0, 0);
311+
}
312+
288313
void dialer_finalizer(SEXP);
289314
void listener_finalizer(SEXP);
290315
void socket_finalizer(SEXP);
291-
void later2(void (*)(void *), void *);
292316
void raio_invoke_cb(void *);
293317
void haio_invoke_cb(void *);
294-
int nano_integer(const SEXP);
295318
SEXP mk_error(const int);
296319
SEXP mk_error_data(const int);
297320
SEXP nano_raw_char(const unsigned char *, const size_t);

0 commit comments

Comments
 (0)