mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
s/BUG_ON/assert/
This commit is contained in:
parent
96e05057a3
commit
581f4ea0c3
8 changed files with 13 additions and 26 deletions
|
|
@ -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 */
|
||||
|
|
@ -28,7 +28,6 @@
|
|||
#include <wlr/xwayland.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include "common/bug-on.h"
|
||||
#include "common/log.h"
|
||||
#include "config/keybind.h"
|
||||
#include "config/rcxml.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <libxml/parser.h>
|
||||
|
|
@ -10,7 +11,6 @@
|
|||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
#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 <keybind key=""> 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")) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright Johan Malm 2020
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#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;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <assert.h>
|
||||
#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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <assert.h>
|
||||
#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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
#include <assert.h>
|
||||
#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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue