x: move redirection failure abort out of x_print_error

x_print_error aborts the program when it sees a redirect_subwindow
failure. A function called x_print_error really shouldn't cause the
program to terminate.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2020-03-27 21:02:38 +00:00
parent b88d98d6b1
commit 574eca3c25
3 changed files with 22 additions and 22 deletions

30
src/x.h
View File

@@ -50,27 +50,27 @@ struct xvisual_info {
#define XCB_AWAIT_VOID(func, c, ...) \
({ \
bool success = true; \
__auto_type e = xcb_request_check(c, func##_checked(c, __VA_ARGS__)); \
if (e) { \
x_print_error(e->sequence, e->major_code, e->minor_code, \
e->error_code); \
free(e); \
success = false; \
bool __success = true; \
__auto_type __e = xcb_request_check(c, func##_checked(c, __VA_ARGS__)); \
if (__e) { \
x_print_error(__e->sequence, __e->major_code, __e->minor_code, \
__e->error_code); \
free(__e); \
__success = false; \
} \
success; \
__success; \
})
#define XCB_AWAIT(func, c, ...) \
({ \
xcb_generic_error_t *e = NULL; \
__auto_type r = func##_reply(c, func(c, __VA_ARGS__), &e); \
if (e) { \
x_print_error(e->sequence, e->major_code, e->minor_code, \
e->error_code); \
free(e); \
xcb_generic_error_t *__e = NULL; \
__auto_type __r = func##_reply(c, func(c, __VA_ARGS__), &__e); \
if (__e) { \
x_print_error(__e->sequence, __e->major_code, __e->minor_code, \
__e->error_code); \
free(__e); \
} \
r; \
__r; \
})
/// Wraps x_new_id. abort the program if x_new_id returns error