Convert all but 2 remaining uses of xassert(false) to BUG("...")

This commit is contained in:
Craig Barnes 2021-02-10 09:01:51 +00:00
parent 2f81a1d07c
commit 3c86af52c2
4 changed files with 12 additions and 17 deletions

8
fdm.c
View file

@ -105,16 +105,12 @@ fdm_add(struct fdm *fdm, int fd, int events, fdm_handler_t handler, void *data)
#if defined(_DEBUG) #if defined(_DEBUG)
int flags = fcntl(fd, F_GETFL); int flags = fcntl(fd, F_GETFL);
if (!(flags & O_NONBLOCK)) { if (!(flags & O_NONBLOCK)) {
LOG_ERR("FD=%d is in blocking mode", fd); BUG("FD=%d is in blocking mode", fd);
xassert(false);
return false;
} }
tll_foreach(fdm->fds, it) { tll_foreach(fdm->fds, it) {
if (it->item->fd == fd) { if (it->item->fd == fd) {
LOG_ERR("FD=%d already registered", fd); BUG("FD=%d already registered", fd);
xassert(false);
return false;
} }
} }
#endif #endif

View file

@ -1225,7 +1225,7 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
break; break;
case TERM_SURF_NONE: case TERM_SURF_NONE:
xassert(false); BUG("Invalid surface type");
break; break;
} }
} }
@ -1806,7 +1806,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
} }
case TERM_SURF_NONE: case TERM_SURF_NONE:
xassert(false); BUG("Invalid surface type");
break; break;
} }

View file

@ -1642,7 +1642,7 @@ render_csd_button(struct terminal *term, enum csd_surface surf_idx)
break; break;
default: default:
xassert(false); BUG("unhandled surface type: %u", (unsigned)surf_idx);
break; break;
} }
@ -1878,7 +1878,7 @@ render_scrollback_position(struct terminal *term)
int surf_top = 0; int surf_top = 0;
switch (term->conf->scrollback.indicator.position) { switch (term->conf->scrollback.indicator.position) {
case SCROLLBACK_INDICATOR_POSITION_NONE: case SCROLLBACK_INDICATOR_POSITION_NONE:
xassert(false); BUG("Invalid scrollback indicator position type");
return; return;
case SCROLLBACK_INDICATOR_POSITION_FIXED: case SCROLLBACK_INDICATOR_POSITION_FIXED:

View file

@ -195,11 +195,10 @@ foreach_selected(
return; return;
case SELECTION_NONE: case SELECTION_NONE:
xassert(false); break;
return;
} }
xassert(false); BUG("Invalid selection kind");
} }
static bool static bool
@ -426,7 +425,7 @@ selection_start(struct terminal *term, int col, int row,
break; break;
case SELECTION_NONE: case SELECTION_NONE:
xassert(false); BUG("Invalid selection kind");
break; break;
} }
@ -728,7 +727,7 @@ selection_update(struct terminal *term, int col, int row)
break; break;
case SELECTION_NONE: case SELECTION_NONE:
xassert(false); BUG("Invalid selection kind");
break; break;
} }
@ -861,7 +860,7 @@ selection_extend_normal(struct terminal *term, int col, int row,
case SELECTION_BLOCK: case SELECTION_BLOCK:
case SELECTION_NONE: case SELECTION_NONE:
xassert(false); BUG("Invalid selection kind in this context");
break; break;
} }
@ -963,7 +962,7 @@ selection_extend(struct seat *seat, struct terminal *term,
switch (term->selection.kind) { switch (term->selection.kind) {
case SELECTION_NONE: case SELECTION_NONE:
xassert(false); BUG("Invalid selection kind");
return; return;
case SELECTION_CHAR_WISE: case SELECTION_CHAR_WISE: