Skip to content

Commit 8bf15c0

Browse files
committed
a few more #nocov tags
1 parent 41153ec commit 8bf15c0

File tree

3 files changed

+48
-49
lines changed

3 files changed

+48
-49
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-02-17 Dirk Eddelbuettel <[email protected]>
2+
3+
* R/tools.R: More #nocov
4+
* inst/include/Rcpp/internal/r_vector.h: Idem
5+
16
2017-02-15 Dirk Eddelbuettel <[email protected]>
27

38
* DESCRIPTION (Version, Date): New minor version

R/tools.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -15,36 +15,36 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1717

18-
externalptr_address <- function(xp){
19-
.Call( as_character_externalptr, xp )
18+
externalptr_address <- function(xp) {
19+
.Call(as_character_externalptr, xp) # #nocov
2020
}
2121

2222
# just like assignInNamespace but first checks that the binding exists
23-
forceAssignInNamespace <- function( x, value, env ){
24-
is_ns <- isNamespace( env )
25-
unlocker <- get( "unlockBinding", baseenv() )
26-
if( is_ns && exists( x, env ) && bindingIsLocked(x, env ) ){
27-
unlocker( x, env )
23+
forceAssignInNamespace <- function(x, value, env) {
24+
is_ns <- isNamespace(env)
25+
unlocker <- get("unlockBinding", baseenv())
26+
if (is_ns && exists(x, env) && bindingIsLocked(x, env)) {
27+
unlocker(x, env)
2828
}
29-
assign( x, value, env )
30-
if( is_ns ){
31-
lockBinding( x, env )
29+
assign(x, value, env)
30+
if (is_ns) {
31+
lockBinding(x, env)
3232
}
3333
}
3434

3535
# Transform a path for passing to the build system on the command line.
36-
# Leave paths alone for posix. For Windows, mirror the behavior of the
36+
# Leave paths alone for posix. For Windows, mirror the behavior of the
3737
# R package build system by starting with the fully resolved absolute path,
38-
# transforming it to a short path name if it contains spaces, and then
38+
# transforming it to a short path name if it contains spaces, and then
3939
# converting backslashes to forward slashes
4040
asBuildPath <- function(path) {
41-
41+
4242
if (.Platform$OS.type == "windows") {
43-
path <- normalizePath(path)
43+
path <- normalizePath(path) # #nocov start
4444
if (grepl(' ', path, fixed=TRUE))
4545
path <- utils::shortPathName(path)
46-
path <- gsub("\\\\", "/", path)
46+
path <- gsub("\\\\", "/", path) # #nocov end
4747
}
48-
48+
4949
return(path)
5050
}

inst/include/Rcpp/internal/r_vector.h

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
33
//
44
// r_vector.h: Rcpp R/C++ interface class library -- information about R vectors
55
//
6-
// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
77
//
88
// This file is part of Rcpp.
99
//
@@ -27,63 +27,62 @@ namespace Rcpp{
2727
namespace internal{
2828

2929
template <int RTYPE>
30-
typename Rcpp::traits::storage_type<RTYPE>::type* r_vector_start(SEXP x){
31-
typedef typename Rcpp::traits::storage_type<RTYPE>::type* pointer ;
32-
return reinterpret_cast<pointer>( dataptr(x) ) ;
30+
typename Rcpp::traits::storage_type<RTYPE>::type* r_vector_start(SEXP x) {
31+
typedef typename Rcpp::traits::storage_type<RTYPE>::type* pointer;
32+
return reinterpret_cast<pointer>(dataptr(x));
3333
}
3434

3535
/**
3636
* The value 0 statically casted to the appropriate type for
3737
* the given SEXP type
3838
*/
39-
template <int RTYPE,typename CTYPE>
40-
inline CTYPE get_zero(){
41-
return static_cast<CTYPE>(0) ;
42-
}
39+
template <int RTYPE,typename CTYPE> // #nocov start
40+
inline CTYPE get_zero() {
41+
return static_cast<CTYPE>(0);
42+
} // #nocov end
4343

4444

4545
/**
4646
* Specialization for Rcomplex
4747
*/
4848
template<>
4949
inline Rcomplex get_zero<CPLXSXP,Rcomplex>(){
50-
Rcomplex x ;
51-
x.r = 0.0 ;
52-
x.i = 0.0 ;
53-
return x ;
50+
Rcomplex x;
51+
x.r = 0.0;
52+
x.i = 0.0;
53+
return x;
5454
}
5555

5656
/**
5757
* Initializes a vector of the given SEXP type. The template fills the
5858
* vector with the value 0 of the appropriate type, for example
5959
* an INTSXP vector is initialized with (int)0, etc...
6060
*/
61-
template<int RTYPE> void r_init_vector(SEXP x){
62-
typedef typename ::Rcpp::traits::storage_type<RTYPE>::type CTYPE ;
63-
CTYPE* start=r_vector_start<RTYPE>(x) ;
64-
std::fill( start, start + Rf_xlength(x), get_zero<RTYPE,CTYPE>() ) ;
65-
}
61+
template<int RTYPE> void r_init_vector(SEXP x) { // #nocov start
62+
typedef typename ::Rcpp::traits::storage_type<RTYPE>::type CTYPE;
63+
CTYPE* start=r_vector_start<RTYPE>(x);
64+
std::fill(start, start + Rf_xlength(x), get_zero<RTYPE,CTYPE>());
65+
} // #nocov end
6666
/**
6767
* Initializes a generic vector (VECSXP). Does nothing since
6868
* R already initializes all elements to NULL
6969
*/
7070
template<>
71-
inline void r_init_vector<VECSXP>(SEXP /*x*/){}
71+
inline void r_init_vector<VECSXP>(SEXP /*x*/) {}
7272

7373
/**
7474
* Initializes an expression vector (EXPRSXP). Does nothing since
7575
* R already initializes all elements to NULL
7676
*/
7777
template<>
78-
inline void r_init_vector<EXPRSXP>(SEXP /*x*/){}
78+
inline void r_init_vector<EXPRSXP>(SEXP /*x*/) {}
7979

8080
/**
8181
* Initializes a character vector (STRSXP). Does nothing since
8282
* R already initializes all elements to ""
8383
*/
8484
template<>
85-
inline void r_init_vector<STRSXP>(SEXP /*x*/){}
86-
85+
inline void r_init_vector<STRSXP>(SEXP /*x*/) {}
8786

8887

8988
/**
@@ -104,36 +103,31 @@ class Sort_is_not_allowed_for_this_type;
104103
* Specialization for CPLXSXP, INTSXP, LGLSXP, REALSXP, and STRSXP
105104
*/
106105
template<>
107-
class Sort_is_not_allowed_for_this_type<CPLXSXP>
108-
{
106+
class Sort_is_not_allowed_for_this_type<CPLXSXP> {
109107
public:
110108
static void do_nothing() {}
111109
};
112110

113111
template<>
114-
class Sort_is_not_allowed_for_this_type<INTSXP>
115-
{
112+
class Sort_is_not_allowed_for_this_type<INTSXP> {
116113
public:
117114
static void do_nothing() {}
118115
};
119116

120117
template<>
121-
class Sort_is_not_allowed_for_this_type<LGLSXP>
122-
{
118+
class Sort_is_not_allowed_for_this_type<LGLSXP> {
123119
public:
124120
static void do_nothing() {}
125121
};
126122

127123
template<>
128-
class Sort_is_not_allowed_for_this_type<REALSXP>
129-
{
124+
class Sort_is_not_allowed_for_this_type<REALSXP> {
130125
public:
131126
static void do_nothing() {}
132127
};
133128

134129
template<>
135-
class Sort_is_not_allowed_for_this_type<STRSXP>
136-
{
130+
class Sort_is_not_allowed_for_this_type<STRSXP> {
137131
public:
138132
static void do_nothing() {}
139133
};

0 commit comments

Comments
 (0)