Skip to content

Commit

Permalink
fix noRemap issue identified by CRAN
Browse files Browse the repository at this point in the history
* basically need to switch to using Rf_* functions from C API
  • Loading branch information
jefferis committed Aug 21, 2024
1 parent 89a3ca4 commit f85cefc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ann2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstring> // C-style strings

#ifdef RANN
#define R_NO_REMAP
#include <R.h> // R headers for error handling
#endif

Expand Down
5 changes: 3 additions & 2 deletions src/vendor/ann/ANN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <ANN/ANNx.h> // all ANN includes
#include <ANN/ANNperf.h> // ANN performance
#ifdef RANN
#define R_NO_REMAP
#include <R.h> // R headers for error handling
#endif

Expand Down Expand Up @@ -173,15 +174,15 @@ void annError(const char* msg, ANNerr level)
{
if (level == ANNabort) {
#ifdef RANN
error("RANN: %s",msg);
Rf_error("RANN: %s",msg);
#else
cerr << "ANN: ERROR------->" << msg << "<-------------ERROR\n";
exit(1);
#endif
}
else {
#ifdef RANN
warning("RANN: %s",msg);
Rf_warning("RANN: %s",msg);
#else
cerr << "ANN: WARNING----->" << msg << "<-------------WARNING\n";
#endif
Expand Down

0 comments on commit f85cefc

Please sign in to comment.