Skip to content

Commit

Permalink
code style eliminates gotos
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 29, 2024
1 parent ae26b62 commit 1c6915f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,19 +340,19 @@ static nano_buf sb_any_buf(const SEXP x) {
if (XLENGTH(x) == 1 && !ANY_ATTRIB(x)) {
const char *s = SB_STRING(x);
NANO_INIT(&buf, (unsigned char *) s, strlen(s));
goto resume;
break;
}
break;
if (0) {
case RAWSXP:
if (!ANY_ATTRIB(x)) {
NANO_INIT(&buf, (unsigned char *) DATAPTR_RO(x), XLENGTH(x));
goto resume;
break;
}
}
default:
sb_serialize(&buf, x);
}

sb_serialize(&buf, x);

resume:
return buf;

}
Expand Down Expand Up @@ -397,9 +397,10 @@ SEXP secretbase_base64dec(SEXP x, SEXP convert) {
size_t inlen, olen;

switch (TYPEOF(x)) {
case STRSXP:
inbuf = (unsigned char *) SB_STRING(x);
inlen = XLENGTH(*((const SEXP *) DATAPTR_RO(x)));
case STRSXP: ;
const char *str = SB_STRING(x);
inbuf = (unsigned char *) str;
inlen = strlen(str);
break;
case RAWSXP:
inbuf = RAW(x);
Expand Down

0 comments on commit 1c6915f

Please sign in to comment.