File tree Expand file tree Collapse file tree 1 file changed +21
-19
lines changed
Expand file tree Collapse file tree 1 file changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,26 @@ T& unmove(T&& t) {
2727 } while (false );
2828#endif
2929
30- #define BEGIN_CPP11 \
31- SEXP err = R_NilValue; \
32- char buf[8192 ] = " " ; \
30+ #define CPP11_ERROR_BUFSIZE 8192
31+
32+ #define BEGIN_CPP11 \
33+ SEXP err = R_NilValue; \
34+ char buf[CPP11_ERROR_BUFSIZE] = " " ; \
3335 try {
34- #define END_CPP11 \
35- } \
36- catch (cpp11::unwind_exception & e) { \
37- err = e.token ; \
38- } \
39- catch (std::exception & e) { \
40- strncpy (buf, e.what (), 8192 - 1 ); \
41- } \
42- catch (...) { \
43- strncpy (buf, " C++ error (unknown cause)" , 8192 - 1 ); \
44- } \
45- if (buf[0 ] != ' \0 ' ) { \
46- Rf_errorcall (R_NilValue, " %s" , buf); \
47- } else if (err != R_NilValue) { \
48- CPP11_UNWIND \
49- } \
36+ #define END_CPP11 \
37+ } \
38+ catch (cpp11::unwind_exception & e) { \
39+ err = e.token ; \
40+ } \
41+ catch (std::exception & e) { \
42+ strncpy (buf, e.what (), sizeof (buf) ); \
43+ } \
44+ catch (...) { \
45+ strncpy (buf, " C++ error (unknown cause)" , sizeof (buf) ); \
46+ } \
47+ if (buf[0 ] != ' \0 ' ) { \
48+ Rf_errorcall (R_NilValue, " %s" , buf); \
49+ } else if (err != R_NilValue) { \
50+ CPP11_UNWIND \
51+ } \
5052 return R_NilValue;
You can’t perform that action at this time.
0 commit comments