Skip to content

Commit 3796d12

Browse files
authored
Feature/issue935 (#940)
* change to Shelter (closes #101) * news and changelog updates
1 parent 2ed7e49 commit 3796d12

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
* R/Attributes.R: better handle pre-existing RcppExports.cpp,
44
RcppExports.R when calling compileAttributes()
55

6+
2019-02-09 Ralf Stubner <[email protected]>
7+
8+
* Rcpp-modules.Rmd: Added example for .factory
9+
10+
2019-01-31 Dirk Eddelbuettel <[email protected]>
11+
12+
* inst/include/Rcpp/protection/Shelter.h (Rcpp): Only increase
13+
nprotected count if object is not NULL (suggested by Stepan Sindelar)
14+
615
2018-12-26 Zhuoer Dong <[email protected]>
716

817
* vignettes/Rcpp-quickref.Rmd: Fix three bugs: use `Named()`, define

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 1.0.0.1
3+
Version: 1.0.0.2
44
Date: 2018-11-11
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou,
66
Nathan Russell, Douglas Bates and John Chambers

inst/NEWS.Rd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
\item A new plugin was added for C++20 (Dirk in \ghpr{927})
1818
\item Fixed an issue where 'stale' symbols could become registered in
1919
RcppExports.cpp, leading to linker errors and other related issues.
20-
(\ghit{733}; \ghit{934})
20+
(Kevin fixing \ghit{733} and \ghit{934})
2121
}
2222
\item Changes in Rcpp Documentation:
2323
\itemize{
2424
\item Three small corrections were added in the 'Rcpp Quickref
2525
vignette (Zhuoer Dong in \ghpr{933} fixing \ghit{932}).
26+
\item The \code{Rcpp-modules} vignette now has documentation for
27+
\code{.factory} (Ralf Stubner in \ghpr{938} fixing \ghit{937}).
2628
}
2729
}
2830
}

inst/include/Rcpp/protection/Shelter.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ namespace Rcpp {
2323
template <class T>
2424
class Shelter {
2525
public:
26-
Shelter() : nprotected(0){}
26+
Shelter() : nprotected(0) {}
2727

28-
inline SEXP operator()(SEXP x){
29-
nprotected++;
30-
return Rcpp_protect(x) ;
28+
inline SEXP operator()(SEXP x) {
29+
if (x != R_NilValue) nprotected++;
30+
return Rcpp_protect(x);
3131
}
3232

3333
~Shelter(){
34-
Rcpp_unprotect(nprotected) ;
35-
nprotected = 0 ;
34+
Rcpp_unprotect(nprotected);
35+
nprotected = 0;
3636
}
3737

3838
private:
39-
int nprotected ;
39+
int nprotected;
4040

4141
// not defined on purpose
4242
Shelter(const Shelter&) ;
4343
Shelter& operator=(const Shelter&) ;
44-
} ;
44+
};
4545
}
4646

4747
#endif

0 commit comments

Comments
 (0)