Skip to content

Commit 8efaedb

Browse files
committed
embed buffer in class to simplify code and avoid Coverity warning
1 parent f9b700a commit 8efaedb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

inst/include/Rcpp/iostream/Rstreambuf.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,11 @@ namespace Rcpp {
4343
template <bool OUTPUT>
4444
class Rostream : public std::ostream {
4545
typedef Rstreambuf<OUTPUT> Buffer ;
46-
Buffer* buf ;
46+
Buffer buf ;
4747
public:
4848
Rostream() :
49-
std::ostream( new Buffer ),
50-
buf( static_cast<Buffer*>( rdbuf() ) )
49+
std::ostream( &buf )
5150
{}
52-
~Rostream() {
53-
if (buf != NULL) {
54-
delete buf;
55-
buf = NULL;
56-
}
57-
}
5851
};
5952
// #nocov start
6053
template <> inline std::streamsize Rstreambuf<true>::xsputn(const char *s, std::streamsize num ) {

0 commit comments

Comments
 (0)