diff --git a/include/common/bug-on.h b/include/common/bug-on.h deleted file mode 100644 index 1b25c803..00000000 --- a/include/common/bug-on.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __LABWC_BUG_ON_H -#define __LABWC_BUG_ON_H - -/** - * BUG_ON - assert() without abort() - * @condition - expression to be evaluated - */ -#define BUG_ON(condition) \ - do { \ - if ((condition) != 0) { \ - fprintf(stderr, "Badness in %s() at %s:%d\n", \ - __func__, __FILE__, __LINE__); \ - } \ - } while (0) - -#endif /* __LABWC_BUG_ON_H */ diff --git a/include/labwc.h b/include/labwc.h index 3675714d..b801e246 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -28,7 +28,6 @@ #include #include -#include "common/bug-on.h" #include "common/log.h" #include "config/keybind.h" #include "config/rcxml.h" diff --git a/src/config/rcxml.c b/src/config/rcxml.c index bc26aa55..0a62c386 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include #include #include #include @@ -10,7 +11,6 @@ #include #include -#include "common/bug-on.h" #include "common/dir.h" #include "common/font.h" #include "common/log.h" @@ -51,7 +51,7 @@ fill_keybind(char *nodename, char *content) current_keybind = keybind_create(content); } /* We expect to come first */ - BUG_ON(!current_keybind); + assert(current_keybind); if (!strcmp(nodename, "name.action")) { current_keybind->action = strdup(content); } else if (!strcmp(nodename, "command.action")) { diff --git a/src/deco.c b/src/deco.c index 4890e3f1..30cf113f 100644 --- a/src/deco.c +++ b/src/deco.c @@ -4,6 +4,7 @@ * Copyright Johan Malm 2020 */ +#include #include "config/rcxml.h" #include "labwc.h" #include "theme/theme.h" @@ -39,7 +40,7 @@ struct wlr_box deco_box(struct view *view, enum deco_part deco_part) { struct wlr_box box = { .x = 0, .y = 0, .width = 0, .height = 0 }; - BUG_ON(!view); + assert(view); switch (deco_part) { case LAB_DECO_BUTTON_CLOSE: box.width = rc.title_height; diff --git a/src/desktop.c b/src/desktop.c index 7d08de29..c3937d53 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -1,3 +1,4 @@ +#include #include "labwc.h" static void @@ -169,7 +170,7 @@ has_mapped_view(struct wl_list *wl_list) struct view * desktop_next_mapped_view(struct view *current) { - BUG_ON(!current); + assert(current); struct server *server = current->server; if (!has_mapped_view(&server->views)) { return NULL; @@ -183,7 +184,7 @@ desktop_next_mapped_view(struct view *current) void desktop_focus_next_mapped_view(struct view *current) { - BUG_ON(!current); + assert(current); struct view *view = desktop_next_mapped_view(current); desktop_focus_view(view); } diff --git a/src/xbm/parse.c b/src/xbm/parse.c index ce733b9d..5589ae26 100644 --- a/src/xbm/parse.c +++ b/src/xbm/parse.c @@ -5,13 +5,13 @@ */ #define _POSIX_C_SOURCE 200809L +#include #include #include #include #include #include -#include "common/bug-on.h" #include "xbm/parse.h" static uint32_t color; @@ -94,7 +94,7 @@ parse_xbm_builtin(const char *button, int size) { struct pixmap pixmap = { 0 }; - BUG_ON(size > LABWC_BUILTIN_ICON_MAX_SIZE); + assert(size <= LABWC_BUILTIN_ICON_MAX_SIZE); pixmap.width = size; pixmap.height = size; diff --git a/src/xdg.c b/src/xdg.c index 92859501..21747e01 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -1,3 +1,4 @@ +#include #include "labwc.h" struct xdg_deco { @@ -73,7 +74,7 @@ static void handle_commit(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, commit); - BUG_ON(!view->surface); + assert(view->surface); view->w = view->surface->current.width; view->h = view->surface->current.height; } diff --git a/src/xwayland.c b/src/xwayland.c index 2c256522..ed11b7bf 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -1,10 +1,11 @@ +#include #include "labwc.h" static void handle_commit(struct wl_listener *listener, void *data) { struct view *view = wl_container_of(listener, view, commit); - BUG_ON(!view->surface); + assert(view->surface); /* Must receive commit signal before accessing surface->current* */ view->w = view->surface->current.width;