From dcc743047b903af8ba409ed25745f891234dc323 Mon Sep 17 00:00:00 2001 From: Johannes Schramm Date: Sun, 21 Jan 2018 16:28:21 +0100 Subject: [PATCH] style: include brackets for if/while/for, even if it's a single statement --- backend/session/logind.c | 4 +++- backend/session/session.c | 3 ++- backend/wayland/backend.c | 24 ++++++++++++++++++------ examples/rotation.c | 8 ++++++-- examples/screenshot.c | 3 ++- types/wlr_surface.c | 3 ++- xwayland/xwm.c | 9 ++++++--- 7 files changed, 39 insertions(+), 15 deletions(-) diff --git a/backend/session/logind.c b/backend/session/logind.c index 0b5b2a632..aa38b46cd 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -330,7 +330,9 @@ static bool add_signal_matches(struct logind_session *session) { static int dbus_event(int fd, uint32_t mask, void *data) { sd_bus *bus = data; - while (sd_bus_process(bus, NULL) > 0); + while (sd_bus_process(bus, NULL) > 0) { + ; + } return 1; } diff --git a/backend/session/session.c b/backend/session/session.c index a5f17b8da..2bbbd4efe 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -307,8 +307,9 @@ size_t wlr_session_find_gpus(struct wlr_session *session, } const char *seat = udev_device_get_property_value(dev, "ID_SEAT"); - if (!seat) + if (!seat) { seat = "seat0"; + } if (session->seat[0] && strcmp(session->seat, seat) != 0) { udev_device_unref(dev); continue; diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 32fdc2b63..f85498ebe 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -85,12 +85,24 @@ static void wlr_wl_backend_destroy(struct wlr_backend *_backend) { wl_event_source_remove(backend->remote_display_src); wlr_egl_finish(&backend->egl); - if (backend->seat) wl_seat_destroy(backend->seat); - if (backend->shm) wl_shm_destroy(backend->shm); - if (backend->shell) zxdg_shell_v6_destroy(backend->shell); - if (backend->compositor) wl_compositor_destroy(backend->compositor); - if (backend->registry) wl_registry_destroy(backend->registry); - if (backend->remote_display) wl_display_disconnect(backend->remote_display); + if (backend->seat) { + wl_seat_destroy(backend->seat); + } + if (backend->shm) { + wl_shm_destroy(backend->shm); + } + if (backend->shell) { + zxdg_shell_v6_destroy(backend->shell); + } + if (backend->compositor) { + wl_compositor_destroy(backend->compositor); + } + if (backend->registry) { + wl_registry_destroy(backend->registry); + } + if (backend->remote_display) { + wl_display_disconnect(backend->remote_display); + } free(backend); } diff --git a/examples/rotation.c b/examples/rotation.c index 1d9740256..6ec6b4395 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -64,8 +64,12 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts odata->x_offs += odata->x_vel * seconds; odata->y_offs += odata->y_vel * seconds; - if (odata->x_offs > 128) odata->x_offs = 0; - if (odata->y_offs > 128) odata->y_offs = 0; + if (odata->x_offs > 128) { + odata->x_offs = 0; + } + if (odata->y_offs > 128) { + odata->y_offs = 0; + } } static void handle_output_add(struct output_state *output) { diff --git a/examples/screenshot.c b/examples/screenshot.c index 441d86845..529af38fe 100644 --- a/examples/screenshot.c +++ b/examples/screenshot.c @@ -277,8 +277,9 @@ int main(int argc, char *argv[]) { screenshooter, output->output, output->buffer); orbital_screenshot_add_listener(screenshot, &screenshot_listener, screenshot); buffer_copy_done = 0; - while (!buffer_copy_done) + while (!buffer_copy_done) { wl_display_roundtrip(display); + } } write_image("wayland-screenshot.png", width, height); diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 8e0241774..b9df8f7da 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -720,8 +720,9 @@ static struct wlr_subsurface *subsurface_find_sibling( struct wlr_subsurface *sibling; wl_list_for_each(sibling, &parent->subsurface_list, parent_link) { - if (sibling->surface == surface && sibling != subsurface) + if (sibling->surface == surface && sibling != subsurface) { return sibling; + } } return NULL; diff --git a/xwayland/xwm.c b/xwayland/xwm.c index dc349ab2a..13e99040e 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -480,12 +480,15 @@ static void read_surface_net_wm_state(struct wlr_xwm *xwm, xsurface->fullscreen = 0; xcb_atom_t *atom = xcb_get_property_value(reply); for (uint32_t i = 0; i < reply->value_len; i++) { - if (atom[i] == xwm->atoms[_NET_WM_STATE_FULLSCREEN]) + if (atom[i] == xwm->atoms[_NET_WM_STATE_FULLSCREEN]) { xsurface->fullscreen = true; - if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT]) + } + if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT]) { xsurface->maximized_vert = true; - if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ]) + } + if (atom[i] == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ]) { xsurface->maximized_horz = true; + } } }