aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-10-30 07:09:11 +1000
committerGravatar axel <axel@liljencrantz.se>2006-10-30 07:09:11 +1000
commitf83575f08447e91d9c26f3e9ff302b428b2c14a9 (patch)
tree7d65bf8e070d2c3965fe3094838b926fec69d754 /common.h
parenta6c00ca0d289f7305b1fe40ae8d0fbc55ac0a417 (diff)
Make sure signals aren't blocked while autoloading, also add a few consistency checks to see that signals aren't blocked in critical places
darcs-hash:20061029210911-ac50b-50bec85c3d59d0332ba44f3ece1a012cdc3e8c4b.gz
Diffstat (limited to 'common.h')
-rw-r--r--common.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/common.h b/common.h
index b787fbe9..99c5671e 100644
--- a/common.h
+++ b/common.h
@@ -74,7 +74,7 @@ extern wchar_t *program_name;
failiure, the current function is ended at once. The second
parameter is the exit status of the current function on failiure.
*/
-#define CHECK( arg, retval ) \
+#define CHECK( arg, retval ) \
if( !(arg) ) \
{ \
debug( 1, \
@@ -85,19 +85,45 @@ extern wchar_t *program_name;
#arg, \
PACKAGE_BUGREPORT ); \
return retval; \
- } \
-
+ }
/**
Exit program at once, leaving an error message about running out of memory
*/
-#define DIE_MEM() \
+#define DIE_MEM() \
{ \
- fwprintf( stderr, L"fish: Out of memory on line %d of file %s, shutting down fish\n", __LINE__, __FILE__ ); \
+ fwprintf( stderr, \
+ L"fish: Out of memory on line %d of file %s, shutting down fish\n", \
+ __LINE__, \
+ __FILE__ ); \
exit(1); \
- } \
+ }
/**
+ Cause fish to crash. This should only be usd for debugging.
+*/
+#define CRASH() \
+ { \
+ int *n = 0; \
+ *n = 1; \
+ }
+
+/**
+ Check if signals are blocked
+*/
+#define CHECK_BLOCK( retval ) \
+ if( signal_is_blocked() ) \
+ { \
+ debug( 0, \
+ L"function %s called while blocking signals. " \
+ L"This is a bug. " \
+ L"If you can reproduce it, please send a bug report to %s.", \
+ __func__, \
+ PACKAGE_BUGREPORT ); \
+ return retval; \
+ }
+
+/**
Shorthand for wgettext call
*/
#define _(wstr) wgettext(wstr)