From d66c454046abdfa4471303554411fda76e401bc3 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:46:46 +0100 Subject: [PATCH] one efficiency --- src/core.c | 2 +- src/utils.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index 2a01e5f08..b9778d43e 100644 --- a/src/core.c +++ b/src/core.c @@ -86,7 +86,7 @@ static SEXP rawOneString(unsigned char *bytes, R_xlen_t nbytes, R_xlen_t *np) { static SEXP nano_inHook(SEXP x, SEXP fun) { - if (!Rf_inherits(x, NANO_STRING(fun))) + if (!Rf_inherits(x, CHAR(fun))) return R_NilValue; SEXP newlist, list, newnames, names, out; diff --git a/src/utils.c b/src/utils.c index 38b0e9ae3..ae7c83d95 100644 --- a/src/utils.c +++ b/src/utils.c @@ -487,14 +487,11 @@ SEXP rnng_serial_config(SEXP socket, SEXP klass, SEXP sfunc, SEXP ufunc, SEXP ve } else { - if (TYPEOF(klass) != STRSXP) - Rf_error("'klass' must be a character string or NULL"); - SEXPTYPE typ1 = TYPEOF(sfunc); SEXPTYPE typ2 = TYPEOF(ufunc); if ((typ1 == CLOSXP || typ1 == SPECIALSXP || typ1 == BUILTINSXP) && (typ2 == CLOSXP || typ2 == SPECIALSXP || typ2 == BUILTINSXP)) { - NANO_SET_PROT(socket, Rf_list4(klass, sfunc, ufunc, vec)); + NANO_SET_PROT(socket, Rf_list4(STRING_ELT(klass, 0), sfunc, ufunc, vec)); } }