changeset 7228:45a083e03fba HEAD

Default failure functions are now public.
author Timo Sirainen <tss@iki.fi>
date Mon, 11 Feb 2008 20:44:23 +0200
parents d64b898066a9
children 586abf9b561c
files src/lib/failures.c src/lib/failures.h
diffstat 2 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/failures.c	Mon Feb 11 20:44:00 2008 +0200
+++ b/src/lib/failures.c	Mon Feb 11 20:44:23 2008 +0200
@@ -25,12 +25,6 @@
 	'I', 'W', 'E', 'F', 'P'
 };
 
-static void default_fatal_handler(enum log_type type, int status,
-				  const char *format, va_list args)
-	ATTR_NORETURN ATTR_FORMAT(3, 0);
-static void default_error_handler(enum log_type type, const char *format,
-				  va_list args) ATTR_FORMAT(2, 0);
-
 /* Initialize working defaults */
 static fatal_failure_callback_t *fatal_handler ATTR_NORETURN =
 	default_fatal_handler;
@@ -144,9 +138,8 @@
 	return ret;
 }
 
-static void ATTR_FORMAT(3, 0)
-default_fatal_handler(enum log_type type, int status,
-		      const char *format, va_list args)
+void default_fatal_handler(enum log_type type, int status,
+			   const char *format, va_list args)
 {
 	const char *backtrace;
 
@@ -165,8 +158,7 @@
 		failure_exit(status);
 }
 
-static void ATTR_FORMAT(2, 0)
-default_error_handler(enum log_type type, const char *format, va_list args)
+void default_error_handler(enum log_type type, const char *format, va_list args)
 {
 	int fd = type == LOG_TYPE_INFO ? log_info_fd : log_fd;
 
--- a/src/lib/failures.h	Mon Feb 11 20:44:00 2008 +0200
+++ b/src/lib/failures.h	Mon Feb 11 20:44:23 2008 +0200
@@ -49,6 +49,13 @@
 void i_set_error_handler(failure_callback_t *callback);
 void i_set_info_handler(failure_callback_t *callback);
 
+/* Send failures to file. */
+void default_fatal_handler(enum log_type type, int status,
+			   const char *format, va_list args)
+	ATTR_NORETURN ATTR_FORMAT(3, 0);
+void default_error_handler(enum log_type type, const char *format, va_list args)
+	ATTR_FORMAT(2, 0);
+
 /* Send failures to syslog() */
 void i_syslog_fatal_handler(enum log_type type, int status,
 			    const char *fmt, va_list args)