Skip to content

Commit

Permalink
fix handlesigfault defs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmohamed committed Oct 19, 2024
1 parent bf7d784 commit 8db1e3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/handlesegfault.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
// Handling Sigfault errors. Prevents the code from exiting R.
// This is only available for UNIX platforms.
#ifndef WIN_COMPILE
#ifdef HAVE_XML
void segfault_KGML(int signal, siginfo_t *si, void *arg){
EVAL(lang2(install("registerMemoryErr"), mkString("KGML2igraph")));
error("Critical memory error in KGML2igraph. Please save your work and restart R.");
}
#endif
#ifdef HAVE_SBML
void segfault_SBML(int signal, siginfo_t *si, void *arg){
EVAL(lang2(install("registerMemoryErr"), mkString("SBML2igraph")));
error("Critical memory error in SBML2igraph. Please save your work and restart R.");
}
#endif
#endif

#ifdef HAVE_XML
void handle_segfault_KGML(){
#ifndef WIN_COMPILE
struct sigaction sa;
Expand All @@ -26,7 +31,9 @@ void handle_segfault_KGML(){
sigaction(SIGSEGV, &sa, NULL);
#endif
}
#endif

#ifdef HAVE_SBML
void handle_segfault_SBML(){
#ifndef WIN_COMPILE
struct sigaction sa;
Expand All @@ -39,3 +46,4 @@ void handle_segfault_SBML(){
sigaction(SIGSEGV, &sa, NULL);
#endif
}
#endif
4 changes: 4 additions & 0 deletions src/handlesegfault.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
extern "C" {
#endif

#ifdef HAVE_XML
void handle_segfault_KGML();
#endif
#ifdef HAVE_SBML
void handle_segfault_SBML();
#endif

#ifdef __cplusplus
}
Expand Down

0 comments on commit 8db1e3a

Please sign in to comment.