Skip to content

Commit 867a841

Browse files
committed
Further tidy ups to #134
1 parent 92e6512 commit 867a841

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/aio.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ static SEXP rnng_aio_collect_impl(SEXP x, SEXP (*const func)(SEXP)) {
364364
PROTECT(out = Rf_allocVector(VECSXP, xlen));
365365
for (R_xlen_t i = 0; i < xlen; i++) {
366366
env = func(NANO_VECTOR(x)[i]);
367-
if (TYPEOF(env) != ENVSXP) goto exit;
367+
if (TYPEOF(env) != ENVSXP) goto fail;
368368
env = Rf_findVarInFrame(env, nano_ValueSymbol);
369-
if (env == R_UnboundValue) goto exit;
369+
if (env == R_UnboundValue) goto fail;
370370
SET_VECTOR_ELT(out, i, env);
371371
}
372372
names = Rf_getAttrib(x, R_NamesSymbol);
@@ -376,7 +376,7 @@ static SEXP rnng_aio_collect_impl(SEXP x, SEXP (*const func)(SEXP)) {
376376
goto resume;
377377
}
378378

379-
exit:
379+
fail:
380380
Rf_error("object is not an Aio or list of Aios");
381381

382382
resume:

src/net.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ SEXP rnng_ip_addr(void) {
8888

8989
#endif
9090

91-
Rf_setAttrib(out, R_NamesSymbol, names);
91+
Rf_namesgets(out, names);
9292

9393
cleanup:
9494
UNPROTECT(2);
@@ -107,11 +107,10 @@ SEXP rnng_write_stdout(SEXP x) {
107107
DWORD bytes;
108108
if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), nbuf, (DWORD) strlen(nbuf), &bytes, NULL)) {}
109109
#else
110-
struct iovec iov[2];
111-
iov[0].iov_base = (void *) buf;
112-
iov[0].iov_len = strlen(buf);
113-
iov[1].iov_base = "\n";
114-
iov[1].iov_len = 1;
110+
struct iovec iov[2] = {
111+
{.iov_base = (void *) buf, .iov_len = strlen(buf)},
112+
{.iov_base = "\n", .iov_len = 1}
113+
};
115114
if (writev(STDOUT_FILENO, iov, 2)) {}
116115
#endif
117116
return R_NilValue;

0 commit comments

Comments
 (0)