From 33a74941c5fd4efb6eefcaace3315d3e2b65681f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Jul 2020 17:30:31 +0200 Subject: Cleanup: Editors, Clang-Tidy else-after-return fixes This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors` module. No functional changes. --- source/blender/editors/space_console/console_ops.c | 46 ++++++++++------------ 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'source/blender/editors/space_console') diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 981e056fa63..f0d4a45a3dd 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -287,12 +287,11 @@ static bool console_line_column_from_index( *r_col = offset - pos; return true; } - else { - *r_cl = NULL; - *r_cl_offset = -1; - *r_col = -1; - return false; - } + + *r_cl = NULL; + *r_cl_offset = -1; + *r_col = -1; + return false; } /* static funcs for text editing */ @@ -403,9 +402,8 @@ static int console_insert_exec(bContext *C, wmOperator *op) if (len == 0) { return OPERATOR_CANCELLED; } - else { - console_select_offset(sc, len); - } + + console_select_offset(sc, len); console_textview_update_rect(sc, region); ED_area_tag_redraw(CTX_wm_area(C)); @@ -426,21 +424,20 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) { return OPERATOR_PASS_THROUGH; } - else { - char str[BLI_UTF8_MAX + 1]; - size_t len; - if (event->utf8_buf[0]) { - len = BLI_str_utf8_size_safe(event->utf8_buf); - memcpy(str, event->utf8_buf, len); - } - else { - /* in theory, ghost can set value to extended ascii here */ - len = BLI_str_utf8_from_unicode(event->ascii, str); - } - str[len] = '\0'; - RNA_string_set(op->ptr, "text", str); + char str[BLI_UTF8_MAX + 1]; + size_t len; + + if (event->utf8_buf[0]) { + len = BLI_str_utf8_size_safe(event->utf8_buf); + memcpy(str, event->utf8_buf, len); + } + else { + /* in theory, ghost can set value to extended ascii here */ + len = BLI_str_utf8_from_unicode(event->ascii, str); } + str[len] = '\0'; + RNA_string_set(op->ptr, "text", str); } return console_insert_exec(C, op); } @@ -674,9 +671,8 @@ static int console_delete_exec(bContext *C, wmOperator *op) if (!done) { return OPERATOR_CANCELLED; } - else { - console_select_offset(sc, -stride); - } + + console_select_offset(sc, -stride); console_textview_update_rect(sc, region); ED_area_tag_redraw(CTX_wm_area(C)); -- cgit v1.2.3