From e7e71a94cdf413ca27cf77729867c940db589353 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 10 Sep 2017 14:11:50 +0100 Subject: Add cleanup to nslog --- include/nslog/nslog.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/nslog/nslog.h') diff --git a/include/nslog/nslog.h b/include/nslog/nslog.h index 0288f5d..9113527 100644 --- a/include/nslog/nslog.h +++ b/include/nslog/nslog.h @@ -257,6 +257,24 @@ nslog_error nslog_set_render_callback(nslog_callback cb, void *context); */ nslog_error nslog_uncork(void); +/** + * Finalise log categories, release filter handles, etc. + * + * Since logging categories can have memory allocated to them at runtime, + * and the logging filters can have references held inside the library, + * clients which wish to be 'valgrind clean' may wish to call this to + * ensure that any memory allocated inside the nslog library is released. + * + * This does not remove the active log callback, so logging calls after this + * returns will still work (though will be unfiltered). Of course, they will + * cause memory to be allocated once more. This function can be called as + * many times as desired, it is idempotent. + * + * If the logging was corked when this was called, pending corked messages + * will be delivered if necessary before any filters are removed. + */ +void nslog_cleanup(void); + /** * Log filter handle * -- cgit v1.2.3