From 58088389ddf19c5e7f5c88c78cb86c3b85b8ed89 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:01:30 +0100 Subject: [PATCH] Avoid R_ExternalPtrTag --- src/aio.c | 56 +++++++++++++++++++++++++------------------------- src/core.c | 34 +++++++++++++++--------------- src/protocol.c | 4 ++-- src/thread.c | 6 +++--- src/utils.c | 10 ++++----- 5 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/aio.c b/src/aio.c index e7dc2783c..2994822ae 100644 --- a/src/aio.c +++ b/src/aio.c @@ -537,7 +537,7 @@ SEXP rnng_aio_call(SEXP x) { switch (TYPEOF(x)) { case ENVSXP: ; const SEXP coreaio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(coreaio) != nano_AioSymbol) + if (TAG(coreaio) != nano_AioSymbol) return x; nano_aio *aiop = (nano_aio *) R_ExternalPtrAddr(coreaio); @@ -622,7 +622,7 @@ SEXP rnng_aio_stop(SEXP x) { switch (TYPEOF(x)) { case ENVSXP: ; const SEXP coreaio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(coreaio) != nano_AioSymbol) break; + if (TAG(coreaio) != nano_AioSymbol) break; nano_aio *aiop = (nano_aio *) R_ExternalPtrAddr(coreaio); nng_aio_stop(aiop->aio); break; @@ -644,7 +644,7 @@ static int rnng_unresolved_impl(SEXP x) { switch (TYPEOF(x)) { case ENVSXP: ; const SEXP coreaio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(coreaio) != nano_AioSymbol) { + if (TAG(coreaio) != nano_AioSymbol) { xc = 0; break; } SEXP value; @@ -696,7 +696,7 @@ static int rnng_unresolved2_impl(SEXP x) { if (TYPEOF(x) == ENVSXP) { const SEXP coreaio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(coreaio) != nano_AioSymbol) + if (TAG(coreaio) != nano_AioSymbol) return 0; nano_aio *aiop = (nano_aio *) R_ExternalPtrAddr(coreaio); return nng_aio_busy(aiop->aio); @@ -734,7 +734,7 @@ SEXP rnng_send_aio(SEXP con, SEXP data, SEXP mode, SEXP timeout, SEXP clo) { nano_buf buf; int sock, xc; - const SEXP ptrtag = R_ExternalPtrTag(con); + const SEXP ptrtag = TAG(con); if ((sock = ptrtag == nano_SocketSymbol) || ptrtag == nano_ContextSymbol) { switch (nano_encodes(mode)) { @@ -825,13 +825,13 @@ SEXP rnng_send_aio(SEXP con, SEXP data, SEXP mode, SEXP timeout, SEXP clo) { SEXP rnng_recv_aio(SEXP con, SEXP mode, SEXP timeout, SEXP cvar, SEXP bytes, SEXP clo) { const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout); - const int signal = R_ExternalPtrTag(cvar) == nano_CvSymbol; + const int signal = TAG(cvar) == nano_CvSymbol; nano_cv *ncv = signal ? (nano_cv *) R_ExternalPtrAddr(cvar) : NULL; nano_aio *raio; SEXP aio; int mod, sock, xc; - const SEXP ptrtag = R_ExternalPtrTag(con); + const SEXP ptrtag = TAG(con); if ((sock = ptrtag == nano_SocketSymbol) || ptrtag == nano_ContextSymbol) { mod = nano_matcharg(mode); @@ -910,7 +910,7 @@ SEXP rnng_ncurl_aio(SEXP http, SEXP convert, SEXP method, SEXP headers, SEXP dat const char *httr = CHAR(STRING_ELT(http, 0)); const char *mthd = method != R_NilValue ? CHAR(STRING_ELT(method, 0)) : NULL; const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout); - if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (tls != R_NilValue && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nano_aio *haio = R_Calloc(1, nano_aio); nano_handle *handle = R_Calloc(1, nano_handle); @@ -1123,7 +1123,7 @@ SEXP rnng_ncurl_session(SEXP http, SEXP convert, SEXP method, SEXP headers, SEXP const char *httr = CHAR(STRING_ELT(http, 0)); const char *mthd = method != R_NilValue ? CHAR(STRING_ELT(method, 0)) : NULL; const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout); - if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (tls != R_NilValue && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nano_aio *haio = R_Calloc(1, nano_aio); @@ -1234,7 +1234,7 @@ SEXP rnng_ncurl_session(SEXP http, SEXP convert, SEXP method, SEXP headers, SEXP SEXP rnng_ncurl_transact(SEXP session) { - if (R_ExternalPtrTag(session) != nano_StatusSymbol) + if (TAG(session) != nano_StatusSymbol) Rf_error("'session' is not a valid or active ncurlSession"); nng_http_conn *conn = (nng_http_conn *) R_ExternalPtrAddr(session); @@ -1290,12 +1290,12 @@ SEXP rnng_ncurl_transact(SEXP session) { SEXP rnng_ncurl_session_close(SEXP session) { - if (R_ExternalPtrTag(session) != nano_StatusSymbol) + if (TAG(session) != nano_StatusSymbol) Rf_error("'session' is not a valid or active ncurlSession"); nng_http_conn *sp = (nng_http_conn *) R_ExternalPtrAddr(session); nng_http_conn_close(sp); - R_SetExternalPtrTag(session, R_NilValue); + SET_TAG(session, R_NilValue); R_SetExternalPtrProtected(session, R_NilValue); R_ClearExternalPtr(session); Rf_setAttrib(session, nano_AioSymbol, R_NilValue); @@ -1308,7 +1308,7 @@ SEXP rnng_ncurl_session_close(SEXP session) { SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeout, SEXP cvar, SEXP clo) { - if (R_ExternalPtrTag(con) != nano_ContextSymbol) + if (TAG(con) != nano_ContextSymbol) Rf_error("'con' is not a valid Context"); const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout); @@ -1318,7 +1318,7 @@ SEXP rnng_request(SEXP con, SEXP data, SEXP sendmode, SEXP recvmode, SEXP timeou signal = 0; drop = 0; } else { - signal = R_ExternalPtrTag(cvar) == nano_CvSymbol; + signal = TAG(cvar) == nano_CvSymbol; drop = 1 - signal; } nng_ctx *ctx = (nng_ctx *) R_ExternalPtrAddr(con); @@ -1396,7 +1396,7 @@ SEXP rnng_set_promise_context(SEXP x, SEXP ctx) { return x; SEXP aio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(aio) != nano_AioSymbol) + if (TAG(aio) != nano_AioSymbol) return x; nano_aio *raio = (nano_aio *) R_ExternalPtrAddr(aio); @@ -1457,7 +1457,7 @@ SEXP rnng_cv_alloc(void) { SEXP rnng_cv_wait(SEXP cvar) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1478,7 +1478,7 @@ SEXP rnng_cv_wait(SEXP cvar) { SEXP rnng_cv_until(SEXP cvar, SEXP msec) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1517,7 +1517,7 @@ SEXP rnng_cv_until(SEXP cvar, SEXP msec) { SEXP rnng_cv_wait_safe(SEXP cvar) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1552,7 +1552,7 @@ SEXP rnng_cv_wait_safe(SEXP cvar) { SEXP rnng_cv_until_safe(SEXP cvar, SEXP msec) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1601,7 +1601,7 @@ SEXP rnng_cv_until_safe(SEXP cvar, SEXP msec) { SEXP rnng_cv_reset(SEXP cvar) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1618,7 +1618,7 @@ SEXP rnng_cv_reset(SEXP cvar) { SEXP rnng_cv_value(SEXP cvar) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); nng_mtx *mtx = ncv->mtx; @@ -1633,7 +1633,7 @@ SEXP rnng_cv_value(SEXP cvar) { SEXP rnng_cv_signal(SEXP cvar) { - if (R_ExternalPtrTag(cvar) != nano_CvSymbol) + if (TAG(cvar) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cvar); @@ -1653,7 +1653,7 @@ SEXP rnng_cv_signal(SEXP cvar) { SEXP rnng_pipe_notify(SEXP socket, SEXP cv, SEXP cv2, SEXP add, SEXP remove, SEXP flag) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); int xc; @@ -1670,7 +1670,7 @@ SEXP rnng_pipe_notify(SEXP socket, SEXP cv, SEXP cv2, SEXP add, SEXP remove, SEX return nano_success; - } else if (R_ExternalPtrTag(cv) != nano_CvSymbol) { + } else if (TAG(cv) != nano_CvSymbol) { Rf_error("'cv' is not a valid Condition Variable"); } @@ -1680,7 +1680,7 @@ SEXP rnng_pipe_notify(SEXP socket, SEXP cv, SEXP cv2, SEXP add, SEXP remove, SEX if (cv2 != R_NilValue) { - if (R_ExternalPtrTag(cv2) != nano_CvSymbol) + if (TAG(cv2) != nano_CvSymbol) Rf_error("'cv2' is not a valid Condition Variable"); cvp->flag = flg < 0 ? 1 : flg; @@ -1716,13 +1716,13 @@ SEXP rnng_pipe_notify(SEXP socket, SEXP cv, SEXP cv2, SEXP add, SEXP remove, SEX SEXP rnng_socket_lock(SEXP socket, SEXP cv) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); int xc; if (cv != R_NilValue) { - if (R_ExternalPtrTag(cv) != nano_CvSymbol) + if (TAG(cv) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); nano_cv *ncv = (nano_cv *) R_ExternalPtrAddr(cv); xc = nng_pipe_notify(*sock, NNG_PIPE_EV_ADD_PRE, pipe_cb_dropcon, ncv); @@ -1739,7 +1739,7 @@ SEXP rnng_socket_lock(SEXP socket, SEXP cv) { SEXP rnng_socket_unlock(SEXP socket) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); diff --git a/src/core.c b/src/core.c index 4934d5911..1104918f5 100644 --- a/src/core.c +++ b/src/core.c @@ -631,7 +631,7 @@ void listener_finalizer(SEXP xptr) { SEXP rnng_ctx_open(SEXP socket) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); @@ -660,7 +660,7 @@ SEXP rnng_ctx_open(SEXP socket) { SEXP rnng_ctx_create(SEXP socket) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); @@ -682,7 +682,7 @@ SEXP rnng_ctx_create(SEXP socket) { SEXP rnng_ctx_close(SEXP context) { - if (R_ExternalPtrTag(context) != nano_ContextSymbol) + if (TAG(context) != nano_ContextSymbol) Rf_error("'context' is not a valid Context"); nng_ctx *ctx = (nng_ctx *) R_ExternalPtrAddr(context); @@ -699,12 +699,12 @@ SEXP rnng_ctx_close(SEXP context) { SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); const uint8_t sec = tls != R_NilValue; - if (sec && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (sec && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); @@ -775,12 +775,12 @@ SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) { SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); const uint8_t sec = tls != R_NilValue; - if (sec && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (sec && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); @@ -846,7 +846,7 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) { SEXP rnng_dialer_start(SEXP dialer, SEXP async) { - if (R_ExternalPtrTag(dialer) != nano_DialerSymbol) + if (TAG(dialer) != nano_DialerSymbol) Rf_error("'dialer' is not a valid Dialer"); nng_dialer *dial = (nng_dialer *) R_ExternalPtrAddr(dialer); const int flags = (*NANO_INTEGER(async) == 1) * NNG_FLAG_NONBLOCK; @@ -861,7 +861,7 @@ SEXP rnng_dialer_start(SEXP dialer, SEXP async) { SEXP rnng_listener_start(SEXP listener) { - if (R_ExternalPtrTag(listener) != nano_ListenerSymbol) + if (TAG(listener) != nano_ListenerSymbol) Rf_error("'listener' is not a valid Listener"); nng_listener *list = (nng_listener *) R_ExternalPtrAddr(listener); const int xc = nng_listener_start(*list, 0); @@ -875,7 +875,7 @@ SEXP rnng_listener_start(SEXP listener) { SEXP rnng_dialer_close(SEXP dialer) { - if (R_ExternalPtrTag(dialer) != nano_DialerSymbol) + if (TAG(dialer) != nano_DialerSymbol) Rf_error("'dialer' is not a valid Dialer"); nng_dialer *dial = (nng_dialer *) R_ExternalPtrAddr(dialer); const int xc = nng_dialer_close(*dial); @@ -888,7 +888,7 @@ SEXP rnng_dialer_close(SEXP dialer) { SEXP rnng_listener_close(SEXP listener) { - if (R_ExternalPtrTag(listener) != nano_ListenerSymbol) + if (TAG(listener) != nano_ListenerSymbol) Rf_error("'listener' is not a valid Listener"); nng_listener *list = (nng_listener *) R_ExternalPtrAddr(listener); const int xc = nng_listener_close(*list); @@ -907,7 +907,7 @@ SEXP rnng_send(SEXP con, SEXP data, SEXP mode, SEXP block) { nano_buf buf; int xc; - const SEXP ptrtag = R_ExternalPtrTag(con); + const SEXP ptrtag = TAG(con); if (ptrtag == nano_SocketSymbol) { switch (nano_encodes(mode)) { @@ -1052,7 +1052,7 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) { size_t sz; SEXP res; - const SEXP ptrtag = R_ExternalPtrTag(con); + const SEXP ptrtag = TAG(con); if (ptrtag == nano_SocketSymbol) { mod = nano_matcharg(mode); @@ -1183,7 +1183,7 @@ SEXP rnng_set_opt(SEXP object, SEXP opt, SEXP value) { const int typ = TYPEOF(value); int xc, val; - const SEXP ptrtag = R_ExternalPtrTag(object); + const SEXP ptrtag = TAG(object); if (ptrtag == nano_SocketSymbol) { nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(object); @@ -1341,7 +1341,7 @@ SEXP rnng_subscribe(SEXP object, SEXP value, SEXP sub) { nano_buf buf; int xc; - const SEXP ptrtag = R_ExternalPtrTag(object); + const SEXP ptrtag = TAG(object); if (ptrtag == nano_SocketSymbol) { nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(object); @@ -1372,7 +1372,7 @@ SEXP rnng_get_opt(SEXP object, SEXP opt) { int xc, typ; nano_opt optval; - const SEXP ptrtag = R_ExternalPtrTag(object); + const SEXP ptrtag = TAG(object); if (ptrtag == nano_SocketSymbol) { nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(object); @@ -1504,7 +1504,7 @@ SEXP rnng_stats_get(SEXP object, SEXP stat) { int xc; nng_stat *nst, *sst; - const SEXP ptrtag = R_ExternalPtrTag(object); + const SEXP ptrtag = TAG(object); if (ptrtag == nano_SocketSymbol) { if ((xc = nng_stats_get(&nst))) ERROR_OUT(xc); diff --git a/src/protocol.c b/src/protocol.c index 21fecfc1a..1a35af7e5 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -144,7 +144,7 @@ SEXP rnng_protocol_open(SEXP protocol, SEXP raw) { SEXP rnng_close(SEXP socket) { - if (R_ExternalPtrTag(socket) != nano_SocketSymbol) + if (TAG(socket) != nano_SocketSymbol) Rf_error("'socket' is not a valid Socket"); nng_socket *sock = (nng_socket *) R_ExternalPtrAddr(socket); const int xc = nng_close(*sock); @@ -159,7 +159,7 @@ SEXP rnng_close(SEXP socket) { SEXP rnng_reap(SEXP con) { int xc; - const SEXP ptrtag = R_ExternalPtrTag(con); + const SEXP ptrtag = TAG(con); if (ptrtag == nano_ContextSymbol) { xc = nng_ctx_close(*(nng_ctx *) R_ExternalPtrAddr(con)); diff --git a/src/thread.c b/src/thread.c index 5133ce4c9..12ef144b3 100644 --- a/src/thread.c +++ b/src/thread.c @@ -234,7 +234,7 @@ SEXP rnng_wait_thread_create(SEXP x) { if (typ == ENVSXP) { const SEXP coreaio = Rf_findVarInFrame(x, nano_AioSymbol); - if (R_ExternalPtrTag(coreaio) != nano_AioSymbol) + if (TAG(coreaio) != nano_AioSymbol) return x; PROTECT(coreaio); @@ -372,10 +372,10 @@ static void rnng_signal_thread(void *args) { SEXP rnng_signal_thread_create(SEXP cv, SEXP cv2) { - if (R_ExternalPtrTag(cv) != nano_CvSymbol) + if (TAG(cv) != nano_CvSymbol) Rf_error("'cv' is not a valid Condition Variable"); - if (R_ExternalPtrTag(cv2) != nano_CvSymbol) + if (TAG(cv2) != nano_CvSymbol) Rf_error("'cv2' is not a valid Condition Variable"); SEXP existing = Rf_getAttrib(cv, R_MissingArg); diff --git a/src/utils.c b/src/utils.c index dd80873e3..3e6f89d61 100644 --- a/src/utils.c +++ b/src/utils.c @@ -159,7 +159,7 @@ SEXP rnng_ncurl(SEXP http, SEXP convert, SEXP follow, SEXP method, SEXP headers, const char *addr = CHAR(STRING_ELT(http, 0)); const char *mthd = method != R_NilValue ? CHAR(STRING_ELT(method, 0)) : NULL; const nng_duration dur = timeout == R_NilValue ? NNG_DURATION_DEFAULT : (nng_duration) Rf_asInteger(timeout); - if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (tls != R_NilValue && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); int chk_resp = response != R_NilValue && TYPEOF(response) == STRSXP; @@ -334,7 +334,7 @@ SEXP rnng_ncurl(SEXP http, SEXP convert, SEXP follow, SEXP method, SEXP headers, SEXP rnng_stream_dial(SEXP url, SEXP textframes, SEXP tls) { const char *add = CHAR(STRING_ELT(url, 0)); - if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (tls != R_NilValue && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nano_stream *nst = R_Calloc(1, nano_stream); nst->mode = NANO_STREAM_DIALER; @@ -423,7 +423,7 @@ SEXP rnng_stream_dial(SEXP url, SEXP textframes, SEXP tls) { SEXP rnng_stream_listen(SEXP url, SEXP textframes, SEXP tls) { const char *add = CHAR(STRING_ELT(url, 0)); - if (tls != R_NilValue && R_ExternalPtrTag(tls) != nano_TlsSymbol) + if (tls != R_NilValue && TAG(tls) != nano_TlsSymbol) Rf_error("'tls' is not a valid TLS Configuration"); nano_stream *nst = R_Calloc(1, nano_stream); nst->mode = NANO_STREAM_LISTENER; @@ -513,11 +513,11 @@ SEXP rnng_stream_listen(SEXP url, SEXP textframes, SEXP tls) { SEXP rnng_stream_close(SEXP stream) { - if (R_ExternalPtrTag(stream) != nano_StreamSymbol) + if (TAG(stream) != nano_StreamSymbol) Rf_error("'stream' is not a valid or active Stream"); stream_finalizer(stream); - R_SetExternalPtrTag(stream, R_NilValue); + SET_TAG(stream, R_NilValue); R_ClearExternalPtr(stream); Rf_setAttrib(stream, nano_StateSymbol, Rf_mkString("closed"));