Search
lxdream.org :: lxdream :: r1096:3f8f4c5b9ef4
lxdream 0.9.1
released Jun 29
Download Now
changeset1096:3f8f4c5b9ef4
parent1095:a8b798030464
child1097:d4807997e450
authornkeynes
dateSun Jan 31 18:30:13 2010 +1000 (10 years ago)
Add first cut of error-reporting structure + macro
src/lxdream.h
1.1 --- a/src/lxdream.h Sun Jan 31 18:28:24 2010 +1000
1.2 +++ b/src/lxdream.h Sun Jan 31 18:30:13 2010 +1000
1.3 @@ -87,6 +87,16 @@
1.4 #define DEBUG( ... ) log_message( NULL, EMIT_DEBUG, MODULE_NAME, __VA_ARGS__ )
1.5 #define TRACE( ... ) log_message( NULL, EMIT_TRACE, MODULE_NAME, __VA_ARGS__ )
1.6
1.7 +/* Error reporting */
1.8 +#define MAX_ERROR_MSG_SIZE 512
1.9 +typedef struct error_struct {
1.10 + unsigned int code;
1.11 + char msg[MAX_ERROR_MSG_SIZE];
1.12 +} ERROR;
1.13 +
1.14 +#define SET_ERROR(err, n, ...) if( (err) != NULL ) { (err)->code = n; snprintf( (err)->msg, sizeof((err)->msg), __VA_ARGS__ ); }
1.15 +#define CLEAR_ERROR(err) do { err.code = 0; err.msg[0] = 0; } while(0)
1.16 +
1.17
1.18 #ifdef HAVE_FASTCALL
1.19 #define FASTCALL __attribute__((regparm(2)))
.