diff options
author | Vicent Marti <tanoku@gmail.com> | 2016-05-24 15:50:44 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-06-06 15:39:05 -0700 |
commit | 42b07cc9c8d2e6251d190e5ea0d13fd66cb51e6d (patch) | |
tree | 493ffc6b16278c54da28645d96a9359717625576 /src/cmark.h | |
parent | 0eafc0af940646ab581e47e63090c1692a3525aa (diff) |
cmake: Global handler for OOM situations
Diffstat (limited to 'src/cmark.h')
-rw-r--r-- | src/cmark.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmark.h b/src/cmark.h index 911ceb7..a43011b 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -573,6 +573,20 @@ int cmark_version(); CMARK_EXPORT const char *cmark_version_string(); +/** Set the callback function that will be issued whenever the + * library hits an out of memory situation. + * + * This can happen when the heap memory allocator fails to allocate + * a block of memory, or when the index of an in-memory buffer overflows + * + * If no OOM handler is set, the library will call `abort` and + * terminate itself and the running process. If the custom OOM handler + * you set does return (i.e. it does not gracefully terminate the + * application), the behavior of the library will be unspecified. + */ +CMARK_EXPORT +void cmark_set_oom_handler(void (*handler)(void)); + /** # AUTHORS * * John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer. |