@@ -123,9 +123,9 @@ SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
123123 (xc = nng_url_parse (& up , ur )) ||
124124 (xc = nng_tls_config_server_name (cfg , up -> u_hostname )) ||
125125 (xc = nng_dialer_set_ptr (* dp , NNG_OPT_TLS_CONFIG , cfg )))
126- goto fail ;
126+ goto exit ;
127127 if (start && (xc = nng_dialer_start (* dp , start == 1 ? NNG_FLAG_NONBLOCK : 0 )))
128- goto fail ;
128+ goto exit ;
129129 nng_url_free (up );
130130 nng_tls_config_hold (cfg );
131131
@@ -137,7 +137,7 @@ SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
137137 } else {
138138
139139 if ((xc = start ? nng_dial (* sock , ur , dp , start == 1 ? NNG_FLAG_NONBLOCK : 0 ) : nng_dialer_create (dp , * sock , ur )))
140- goto fail ;
140+ goto exit ;
141141
142142 PROTECT (dialer = R_MakeExternalPtr (dp , nano_DialerSymbol , R_NilValue ));
143143
@@ -162,7 +162,7 @@ SEXP rnng_dial(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
162162 UNPROTECT (2 );
163163 return nano_success ;
164164
165- fail :
165+ exit :
166166 if (up ) nng_url_free (up );
167167 R_Free (dp );
168168 if (NANO_INTEGER (error )) ERROR_OUT (xc );
@@ -194,9 +194,9 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
194194 (xc = nng_url_parse (& up , ur )) ||
195195 (xc = nng_tls_config_server_name (cfg , up -> u_hostname )) ||
196196 (xc = nng_listener_set_ptr (* lp , NNG_OPT_TLS_CONFIG , cfg )))
197- goto fail ;
197+ goto exit ;
198198 if (start && (xc = nng_listener_start (* lp , 0 )))
199- goto fail ;
199+ goto exit ;
200200 nng_url_free (up );
201201 nng_tls_config_hold (cfg );
202202
@@ -208,7 +208,7 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
208208 } else {
209209
210210 if ((xc = start ? nng_listen (* sock , ur , lp , 0 ) : nng_listener_create (lp , * sock , ur )))
211- goto fail ;
211+ goto exit ;
212212
213213 PROTECT (listener = R_MakeExternalPtr (lp , nano_ListenerSymbol , R_NilValue ));
214214
@@ -234,7 +234,7 @@ SEXP rnng_listen(SEXP socket, SEXP url, SEXP tls, SEXP autostart, SEXP error) {
234234 UNPROTECT (2 );
235235 return nano_success ;
236236
237- fail :
237+ exit :
238238 if (up ) nng_url_free (up );
239239 R_Free (lp );
240240 if (NANO_INTEGER (error )) ERROR_OUT (xc );
@@ -316,14 +316,14 @@ SEXP rnng_send(SEXP con, SEXP data, SEXP mode, SEXP block) {
316316 if (flags <= 0 ) {
317317
318318 if ((xc = nng_send (* sock , buf .buf , buf .cur , flags ? NNG_FLAG_NONBLOCK : (NANO_INTEGER (block ) != 1 ) * NNG_FLAG_NONBLOCK )))
319- goto fail ;
319+ goto exit ;
320320
321321 } else {
322322
323323 if ((xc = nng_msg_alloc (& msgp , 0 )) ||
324324 (xc = nng_msg_append (msgp , buf .buf , buf .cur )) ||
325325 (xc = nng_aio_alloc (& aiop , NULL , NULL )))
326- goto fail ;
326+ goto exit ;
327327
328328 nng_aio_set_msg (aiop , msgp );
329329 nng_aio_set_timeout (aiop , flags );
@@ -345,14 +345,14 @@ SEXP rnng_send(SEXP con, SEXP data, SEXP mode, SEXP block) {
345345 if ((xc = nng_msg_alloc (& msgp , 0 )) ||
346346 (xc = nng_msg_append (msgp , buf .buf , buf .cur )) ||
347347 (xc = nng_ctx_sendmsg (* ctxp , msgp , flags ? NNG_FLAG_NONBLOCK : (NANO_INTEGER (block ) != 1 ) * NNG_FLAG_NONBLOCK )))
348- goto fail ;
348+ goto exit ;
349349
350350 } else {
351351
352352 if ((xc = nng_msg_alloc (& msgp , 0 )) ||
353353 (xc = nng_msg_append (msgp , buf .buf , buf .cur )) ||
354354 (xc = nng_aio_alloc (& aiop , NULL , NULL )))
355- goto fail ;
355+ goto exit ;
356356
357357 nng_aio_set_msg (aiop , msgp );
358358 nng_aio_set_timeout (aiop , flags );
@@ -377,7 +377,7 @@ SEXP rnng_send(SEXP con, SEXP data, SEXP mode, SEXP block) {
377377
378378 if ((xc = nng_aio_alloc (& aiop , NULL , NULL )) ||
379379 (xc = nng_aio_set_iov (aiop , 1u , & iov )))
380- goto fail ;
380+ goto exit ;
381381
382382 nng_aio_set_timeout (aiop , flags ? flags : (NANO_INTEGER (block ) != 0 ) * NNG_DURATION_DEFAULT );
383383 nng_stream_send (sp , aiop );
@@ -396,7 +396,7 @@ SEXP rnng_send(SEXP con, SEXP data, SEXP mode, SEXP block) {
396396
397397 return nano_success ;
398398
399- fail :
399+ exit :
400400 if (aiop ) nng_aio_free (aiop );
401401 if (msgp ) nng_msg_free (msgp );
402402 NANO_FREE (buf );
@@ -422,20 +422,20 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) {
422422 if (flags <= 0 ) {
423423
424424 if ((xc = nng_recv (* sock , & buf , & sz , NNG_FLAG_ALLOC + (flags < 0 || NANO_INTEGER (block ) != 1 ) * NNG_FLAG_NONBLOCK )))
425- goto fail ;
425+ goto exit ;
426426
427427 res = nano_decode (buf , sz , mod , NANO_PROT (con ));
428428 nng_free (buf , sz );
429429
430430 } else {
431431
432432 if ((xc = nng_aio_alloc (& aiop , NULL , NULL )))
433- goto fail ;
433+ goto exit ;
434434 nng_aio_set_timeout (aiop , flags );
435435 nng_recv_aio (* sock , aiop );
436436 nng_aio_wait (aiop );
437437 if ((xc = nng_aio_result (aiop )))
438- goto fail ;
438+ goto exit ;
439439 nng_msg * msgp = nng_aio_get_msg (aiop );
440440 nng_aio_free (aiop );
441441 buf = nng_msg_body (msgp );
@@ -453,7 +453,7 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) {
453453 if (flags <= 0 ) {
454454
455455 if ((xc = nng_ctx_recvmsg (* ctxp , & msgp , (flags < 0 || NANO_INTEGER (block ) != 1 ) * NNG_FLAG_NONBLOCK )))
456- goto fail ;
456+ goto exit ;
457457
458458 buf = nng_msg_body (msgp );
459459 sz = nng_msg_len (msgp );
@@ -463,13 +463,13 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) {
463463 } else {
464464
465465 if ((xc = nng_aio_alloc (& aiop , NULL , NULL )))
466- goto fail ;
466+ goto exit ;
467467 nng_aio_set_timeout (aiop , flags );
468468 nng_ctx_recv (* ctxp , aiop );
469469
470470 nng_aio_wait (aiop );
471471 if ((xc = nng_aio_result (aiop )))
472- goto fail ;
472+ goto exit ;
473473
474474 msgp = nng_aio_get_msg (aiop );
475475 nng_aio_free (aiop );
@@ -493,14 +493,14 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) {
493493
494494 if ((xc = nng_aio_alloc (& aiop , NULL , NULL )) ||
495495 (xc = nng_aio_set_iov (aiop , 1u , & iov )))
496- goto fail2 ;
496+ goto exit2 ;
497497
498498 nng_aio_set_timeout (aiop , flags ? flags : (NANO_INTEGER (block ) != 0 ) * NNG_DURATION_DEFAULT );
499499 nng_stream_recv (* sp , aiop );
500500
501501 nng_aio_wait (aiop );
502502 if ((xc = nng_aio_result (aiop )))
503- goto fail2 ;
503+ goto exit2 ;
504504
505505 sz = nng_aio_count (aiop );
506506 nng_aio_free (aiop );
@@ -513,9 +513,9 @@ SEXP rnng_recv(SEXP con, SEXP mode, SEXP block, SEXP bytes) {
513513
514514 return res ;
515515
516- fail2 :
516+ exit2 :
517517 R_Free (buf );
518- fail :
518+ exit :
519519 if (aiop ) nng_aio_free (aiop );
520520 return mk_error (xc );
521521
0 commit comments