diff --git a/awesome.c b/awesome.c index 2561d2f65..dd47a6fdb 100644 --- a/awesome.c +++ b/awesome.c @@ -97,7 +97,7 @@ scan(void) /* Get the tree of the children windows of the current root window */ if(!(wins = xcb_query_tree_children(tree_r))) - eprint("E: cannot get tree children"); + fatal("E: cannot get tree children"); tree_c_len = xcb_query_tree_children_length(tree_r); attr_wins = p_new(xcb_get_window_attributes_cookie_t, tree_c_len); @@ -207,7 +207,7 @@ xerrorstart(void * data __attribute__ ((unused)), xcb_connection_t * c __attribute__ ((unused)), xcb_generic_error_t * error __attribute__ ((unused))) { - eprint("another window manager is already running"); + fatal("another window manager is already running"); } /** Function to exit on some signals. @@ -338,7 +338,7 @@ main(int argc, char **argv) if(a_strlen(optarg)) confpath = a_strdup(optarg); else - eprint("-c option requires a file name"); + fatal("-c option requires a file name"); break; } @@ -361,7 +361,7 @@ main(int argc, char **argv) /* X stuff */ globalconf.connection = xcb_connect(NULL, &globalconf.default_screen); if(xcb_connection_has_error(globalconf.connection)) - eprint("cannot open display"); + fatal("cannot open display"); /* Get the file descriptor corresponding to the X connection */ xfd = xcb_get_file_descriptor(globalconf.connection); @@ -440,7 +440,7 @@ main(int argc, char **argv) warn("failed to load/parse configuration file %s", confpath); warn("falling back to: %s", default_confpath); if(!luaA_parserc(default_confpath)) - eprint("failed to load any configuration file"); + fatal("failed to load any configuration file"); } /* do this only for real screen */ diff --git a/common/util.c b/common/util.c index 2ac1e3f93..7ff26631a 100644 --- a/common/util.c +++ b/common/util.c @@ -28,10 +28,10 @@ #include "util.h" -/** Print error and exit with EXIT_FAILURE code +/** Print error and exit with EXIT_FAILURE code. */ void -_eprint(int line, const char *fct, const char *fmt, ...) +_fatal(int line, const char *fct, const char *fmt, ...) { va_list ap; @@ -43,7 +43,7 @@ _eprint(int line, const char *fct, const char *fmt, ...) exit(EXIT_FAILURE); } -/** Print error message on stderr +/** Print error message on stderr. */ void _warn(int line, const char *fct, const char *fmt, ...) diff --git a/common/util.h b/common/util.h index aa0f88ceb..321772642 100644 --- a/common/util.h +++ b/common/util.h @@ -285,10 +285,10 @@ a_strtobool(const char *s) return false; } -#define eprint(string, ...) _eprint(__LINE__, \ - __FUNCTION__, \ - string, ## __VA_ARGS__) -void _eprint(int, const char *, const char *, ...) +#define fatal(string, ...) _fatal(__LINE__, \ + __FUNCTION__, \ + string, ## __VA_ARGS__) +void _fatal(int, const char *, const char *, ...) __attribute__ ((noreturn)) __attribute__ ((format(printf, 3, 4))); #define warn(string, ...) _warn(__LINE__, \ diff --git a/common/xutil.h b/common/xutil.h index d91be82d2..3dca3bf2c 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -170,7 +170,7 @@ static inline xcb_screen_t * xutil_screen_get(xcb_connection_t *c, int screen) { if(xcb_connection_has_error(c)) - eprint("X connection invalid"); + fatal("X connection invalid"); return xcb_aux_get_screen(c, screen); }