src: prefer 'if' over 'goto' where convenient

'goto' should not be used for normal control flow.

v2 add comment in lieu of goto label
This commit is contained in:
John Lindgren 2025-07-04 00:44:22 -04:00 committed by Consolatis
parent 8b7ae52a91
commit b48c250177
2 changed files with 23 additions and 25 deletions

View file

@ -543,20 +543,19 @@ ssd_update_button_hover(struct wlr_scene_node *node,
struct ssd_hover_state *hover_state)
{
struct ssd_button *button = NULL;
if (!node || !node->data) {
goto disable_old_hover;
}
struct node_descriptor *desc = node->data;
if (desc->type == LAB_NODE_DESC_SSD_BUTTON) {
button = node_ssd_button_from_node(node);
if (button == hover_state->button) {
/* Cursor is still on the same button */
return;
if (node && node->data) {
struct node_descriptor *desc = node->data;
if (desc->type == LAB_NODE_DESC_SSD_BUTTON) {
button = node_ssd_button_from_node(node);
if (button == hover_state->button) {
/* Cursor is still on the same button */
return;
}
}
}
disable_old_hover:
/* Disable old hover */
if (hover_state->button) {
update_button_state(hover_state->button, LAB_BS_HOVERD, false);
hover_state->view = NULL;