@@ -1254,7 +1254,7 @@ attribute_hidden SEXP do_grep(SEXP call, SEXP op, SEXP args, SEXP env)
12541254    regex_t  reg ;
12551255    R_xlen_t  i , j , n ;
12561256    int  nmatches  =  0 , rc ;
1257-     int  igcase_opt , value_opt , perl_opt , fixed_opt , useBytes , invert ;
1257+     Rboolean  igcase_opt , value_opt , perl_opt , fixed_opt , useBytes , invert ;
12581258    const  char  * spat  =  NULL ;
12591259    const  wchar_t  * wpat  =  NULL ;
12601260    const  unsigned char   * tables  =  NULL  /* -Wall */ ;
@@ -1276,18 +1276,12 @@ attribute_hidden SEXP do_grep(SEXP call, SEXP op, SEXP args, SEXP env)
12761276    checkArity (op , args );
12771277    pat  =  CAR (args ); args  =  CDR (args );
12781278    text  =  CAR (args ); args  =  CDR (args );
1279-     igcase_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1280-     value_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1281-     perl_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1282-     fixed_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1283-     useBytes  =  asLogical (CAR (args )); args  =  CDR (args );
1284-     invert  =  asLogical (CAR (args ));
1285-     if  (igcase_opt  ==  NA_INTEGER ) igcase_opt  =  0 ;
1286-     if  (value_opt  ==  NA_INTEGER ) value_opt  =  0 ;
1287-     if  (perl_opt  ==  NA_INTEGER ) perl_opt  =  0 ;
1288-     if  (fixed_opt  ==  NA_INTEGER ) fixed_opt  =  0 ;
1289-     if  (useBytes  ==  NA_INTEGER ) useBytes  =  0 ;
1290-     if  (invert  ==  NA_INTEGER ) invert  =  0 ;
1279+     igcase_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1280+     value_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1281+     perl_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1282+     fixed_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1283+     useBytes  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1284+     invert  =  asRbool (CAR (args ), call );
12911285    if  (fixed_opt  &&  igcase_opt )
12921286	warning (_ ("argument '%s' will be ignored" ), "ignore.case = TRUE" );
12931287    if  (fixed_opt  &&  perl_opt ) {
@@ -1573,22 +1567,17 @@ attribute_hidden SEXP do_grepraw(SEXP call, SEXP op, SEXP args, SEXP env)
15731567			    offset+length it is the initial size of 
15741568			    the integer vector of matches */ 
15751569    R_size_t  res_ptr , offset , i ;
1576-     int  igcase_opt , fixed_opt , all , value , invert ;
1570+     Rboolean  igcase_opt , fixed_opt , all , value , invert ;
15771571
15781572    checkArity (op , args );
15791573    pat  =  CAR (args ); args  =  CDR (args );
15801574    text  =  CAR (args ); args  =  CDR (args );
15811575    offset  =  asInteger (CAR (args )); args  =  CDR (args );
1582-     igcase_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1583-     fixed_opt  =  asLogical (CAR (args )); args  =  CDR (args );
1584-     value  =  asLogical (CAR (args )); args  =  CDR (args );
1585-     all  =  asLogical (CAR (args )); args  =  CDR (args );
1586-     invert  =  asLogical (CAR (args ));
1587-     if  (igcase_opt  ==  NA_INTEGER ) igcase_opt  =  0 ;
1588-     if  (fixed_opt  ==  NA_INTEGER ) fixed_opt  =  0 ;
1589-     if  (all  ==  NA_INTEGER ) all  =  0 ;
1590-     if  (value  ==  NA_INTEGER ) value  =  0 ;
1591-     if  (invert  ==  NA_INTEGER ) invert  =  0 ;
1576+     igcase_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1577+     fixed_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1578+     value  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1579+     all  =  asRbool (CAR (args ), call ); args  =  CDR (args );
1580+     invert  =  asRbool (CAR (args ), call );
15921581    if  (fixed_opt  &&  igcase_opt )
15931582	warning (_ ("argument '%s' will be ignored" ), "ignore.case = TRUE" );
15941583
@@ -2106,7 +2095,8 @@ attribute_hidden SEXP do_gsub(SEXP call, SEXP op, SEXP args, SEXP env)
21062095    regmatch_t  regmatch [10 ];
21072096    R_xlen_t  i , n ;
21082097    int  j , ns , nns , nmatch , offset , rc ;
2109-     int  global , igcase_opt , perl_opt , fixed_opt , useBytes , eflags , last_end ;
2098+     Rboolean  global , igcase_opt , perl_opt , fixed_opt , useBytes ;
2099+     int  eflags , last_end ;
21102100    char  * u , * cbuf ;
21112101    const  char  * spat  =  NULL , * srep  =  NULL , * s  =  NULL ;
21122102    size_t  patlen  =  0 , replen  =  0 ;
@@ -2134,14 +2124,10 @@ attribute_hidden SEXP do_gsub(SEXP call, SEXP op, SEXP args, SEXP env)
21342124    pat  =  CAR (args ); args  =  CDR (args );
21352125    rep  =  CAR (args ); args  =  CDR (args );
21362126    text  =  CAR (args ); args  =  CDR (args );
2137-     igcase_opt  =  asLogical (CAR (args )); args  =  CDR (args );
2138-     perl_opt  =  asLogical (CAR (args )); args  =  CDR (args );
2139-     fixed_opt  =  asLogical (CAR (args )); args  =  CDR (args );
2140-     useBytes  =  asLogical (CAR (args )); args  =  CDR (args );
2141-     if  (igcase_opt  ==  NA_INTEGER ) igcase_opt  =  0 ;
2142-     if  (perl_opt  ==  NA_INTEGER ) perl_opt  =  0 ;
2143-     if  (fixed_opt  ==  NA_INTEGER ) fixed_opt  =  0 ;
2144-     if  (useBytes  ==  NA_INTEGER ) useBytes  =  0 ;
2127+     igcase_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
2128+     perl_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
2129+     fixed_opt  =  asRbool (CAR (args ), call ); args  =  CDR (args );
2130+     useBytes  =  asRbool (CAR (args ), call ); args  =  CDR (args );
21452131    if  (fixed_opt  &&  igcase_opt )
21462132	warning (_ ("argument '%s' will be ignored" ), "ignore.case = TRUE" );
21472133    if  (fixed_opt  &&  perl_opt ) {
0 commit comments