(CANT_REACH): New. Use it instead of CANT_HAPPEN() where possible.

(oops): Cope with NULL argument passed by CANT_REACH().
This commit is contained in:
Markus Armbruster 2006-04-17 17:36:07 +00:00
parent 98d35dec3e
commit 6fee3f4535
13 changed files with 26 additions and 19 deletions

View file

@ -113,9 +113,16 @@ extern int daemonize;
/*
* If EXPR is true, an internal error occured.
* Return EXPR != 0.
* Usage: if (CANT_HAPPEN(...)) recovery_code();
* Usage: if (CANT_HAPPEN(...)) <recovery code>;
*/
#define CANT_HAPPEN(expr) ((expr) ? oops(#expr, __FILE__, __LINE__) : 0)
/*
* Report internal error.
* Usage: CANT_REACH(); <recovery code>;
*/
#define CANT_REACH() (void)oops(NULL, __FILE__, __LINE__)
extern int oops(char *, char *, int);
/* return codes from command routines */