Skip to content

Commit 136d50f

Browse files
committed
changelog and news for #763, whitespace edits
1 parent e2a70a6 commit 136d50f

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2017-10-03 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/iostream/Rstreambuf.h: White-space edits
4+
5+
2017-10-02 Kirill Müller <[email protected]>
6+
7+
* inst/include/Rcpp/iostream/Rstreambuf.h: Embed buffer class instance
8+
in Rostream to not require run-time allocation, and please Coverity
9+
110
2017-09-29 Dirk Eddelbuettel <[email protected]>
211

312
* DESCRIPTION (Version, Date): Roll minor version

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
\itemize{
1010
\item New const iterators functions \code{cbegin()} and \code{cend()}
1111
added to \code{MatrixRow} as well (Dan Dillon in \ghpr{750}).
12+
\item The \code{Rostream} object now contains a \code{Buffer} rather than
13+
allocating one (Kirill Müller in \ghpr{763}).
1214
}
1315
\item Changes in Rcpp Package:
1416
\itemize{

inst/include/Rcpp/iostream/Rstreambuf.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,54 +33,52 @@ namespace Rcpp {
3333
Rstreambuf(){}
3434

3535
protected:
36-
virtual std::streamsize xsputn(const char *s, std::streamsize n );
36+
virtual std::streamsize xsputn(const char *s, std::streamsize n);
3737

38-
virtual int overflow(int c = traits_type::eof() );
38+
virtual int overflow(int c = traits_type::eof());
3939

40-
virtual int sync() ;
40+
virtual int sync();
4141
};
4242

4343
template <bool OUTPUT>
4444
class Rostream : public std::ostream {
45-
typedef Rstreambuf<OUTPUT> Buffer ;
46-
Buffer buf ;
45+
typedef Rstreambuf<OUTPUT> Buffer;
46+
Buffer buf;
4747
public:
48-
Rostream() :
49-
std::ostream( &buf )
50-
{}
48+
Rostream() : std::ostream( &buf ) {}
5149
};
5250
// #nocov start
53-
template <> inline std::streamsize Rstreambuf<true>::xsputn(const char *s, std::streamsize num ) {
54-
Rprintf( "%.*s", num, s ) ;
55-
return num ;
51+
template <> inline std::streamsize Rstreambuf<true>::xsputn(const char *s, std::streamsize num) {
52+
Rprintf("%.*s", num, s);
53+
return num;
5654
}
57-
template <> inline std::streamsize Rstreambuf<false>::xsputn(const char *s, std::streamsize num ) {
58-
REprintf( "%.*s", num, s ) ;
59-
return num ;
55+
template <> inline std::streamsize Rstreambuf<false>::xsputn(const char *s, std::streamsize num) {
56+
REprintf("%.*s", num, s);
57+
return num;
6058
}
6159

62-
template <> inline int Rstreambuf<true>::overflow(int c ) {
60+
template <> inline int Rstreambuf<true>::overflow(int c) {
6361
if (c != traits_type::eof()) {
6462
char_type ch = traits_type::to_char_type(c);
6563
return xsputn(&ch, 1) == 1 ? c : traits_type::eof();
6664
}
6765
return c;
6866
}
69-
template <> inline int Rstreambuf<false>::overflow(int c ) {
67+
template <> inline int Rstreambuf<false>::overflow(int c) {
7068
if (c != traits_type::eof()) {
7169
char_type ch = traits_type::to_char_type(c);
7270
return xsputn(&ch, 1) == 1 ? c : traits_type::eof();
7371
}
7472
return c;
7573
}
7674

77-
template <> inline int Rstreambuf<true>::sync(){
78-
::R_FlushConsole() ;
79-
return 0 ;
75+
template <> inline int Rstreambuf<true>::sync() {
76+
::R_FlushConsole();
77+
return 0;
8078
}
81-
template <> inline int Rstreambuf<false>::sync(){
82-
::R_FlushConsole() ;
83-
return 0 ;
79+
template <> inline int Rstreambuf<false>::sync() {
80+
::R_FlushConsole();
81+
return 0;
8482
} // #nocov end
8583
static Rostream<true> Rcout;
8684
static Rostream<false> Rcerr;

0 commit comments

Comments
 (0)