diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-04-03 15:49:36 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-03-20 15:30:23 +0100 |
commit | c1403ee6bf4dfdd8f614f84ef145083b06a9f23e (patch) | |
tree | a0f72aa7e4ca235d3017760891bebc964dd530d8 /common/quic.h | |
parent | bb133148d85e66349b34375dd849d5d8c422da67 (diff) | |
download | spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.tar.gz spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.tar.xz spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.zip |
Use a log handler to modify abort() behaviour
Be more library friendly, by not aborting in library errors.
spice_common now includes a proper log handler that will abort by
default when reaching a warning.
SPICE_ABORT_LEVEL can be changed to modify run-time abort level.
SPICE_DEBUG_LEVEL can be changed to be more verbose. By default, only
log level more importants than WARNING.
Only memory-related functions are allowed to abort(), since they are
not recoverable errors in the library.
Diffstat (limited to 'common/quic.h')
-rw-r--r-- | common/quic.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/quic.h b/common/quic.h index 7ec94f5..58e68f7 100644 --- a/common/quic.h +++ b/common/quic.h @@ -20,6 +20,7 @@ #define __QUIC_H #include "quic_config.h" +#include "macros.h" #ifdef __cplusplus extern "C" { @@ -41,9 +42,9 @@ typedef void *QuicContext; typedef struct QuicUsrContext QuicUsrContext; struct QuicUsrContext { - void (*error)(QuicUsrContext *usr, const char *fmt, ...); - void (*warn)(QuicUsrContext *usr, const char *fmt, ...); - void (*info)(QuicUsrContext *usr, const char *fmt, ...); + ATTR_PRINTF(2, 3) void (*error)(QuicUsrContext *usr, const char *fmt, ...); + ATTR_PRINTF(2, 3) void (*warn)(QuicUsrContext *usr, const char *fmt, ...); + ATTR_PRINTF(2, 3) void (*info)(QuicUsrContext *usr, const char *fmt, ...); void *(*malloc)(QuicUsrContext *usr, int size); void (*free)(QuicUsrContext *usr, void *ptr); int (*more_space)(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed); |