Skip to content

Commit 9355565

Browse files
author
ripley
committed
use asRbool in strsplit()
git-svn-id: https://svn.r-project.org/R/trunk@87811 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 34db889 commit 9355565

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main/grep.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ attribute_hidden SEXP do_strsplit(SEXP call, SEXP op, SEXP args, SEXP env)
550550
SEXP args0 = args, ans, tok, x;
551551
R_xlen_t i, itok, len, tlen;
552552
size_t j, ntok;
553-
int fixed_opt, perl_opt, useBytes;
553+
Rboolean fixed_opt, perl_opt, useBytes;
554554
char *pt = NULL; wchar_t *wpt = NULL;
555555
const char *buf, *split = "", *bufp;
556556
const unsigned char *tables = NULL;
@@ -562,12 +562,9 @@ attribute_hidden SEXP do_strsplit(SEXP call, SEXP op, SEXP args, SEXP env)
562562
checkArity(op, args);
563563
x = CAR(args); args = CDR(args);
564564
tok = CAR(args); args = CDR(args);
565-
fixed_opt = asLogical(CAR(args)); args = CDR(args);
566-
perl_opt = asLogical(CAR(args)); args = CDR(args);
567-
useBytes = asLogical(CAR(args));
568-
if (fixed_opt == NA_INTEGER) fixed_opt = 0;
569-
if (perl_opt == NA_INTEGER) perl_opt = 0;
570-
if (useBytes == NA_INTEGER) useBytes = 0;
565+
fixed_opt = asRbool(CAR(args), call); args = CDR(args);
566+
perl_opt = asRbool(CAR(args), call); args = CDR(args);
567+
useBytes = asRbool(CAR(args), call);
571568
if (fixed_opt && perl_opt) {
572569
warning(_("argument '%s' will be ignored"), "perl = TRUE");
573570
perl_opt = 0;

0 commit comments

Comments
 (0)