From 8a93d0b3be5b6d80a1bef85bc73b2661f5ab4376 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 31 Dec 2020 12:37:57 +0100 Subject: Avoid "else" after "break" and "return" --- src/string_utils.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/string_utils.h') diff --git a/src/string_utils.h b/src/string_utils.h index 744ba4ca..a80c3a27 100644 --- a/src/string_utils.h +++ b/src/string_utils.h @@ -119,13 +119,20 @@ utf8_num_bytes(const uint8_t c) { if ((c & 0x80) == 0) { // Starts with `0' return 1; - } else if ((c & 0xE0) == 0xC0) { // Starts with `110' + } + + if ((c & 0xE0) == 0xC0) { // Starts with `110' return 2; - } else if ((c & 0xF0) == 0xE0) { // Starts with `1110' + } + + if ((c & 0xF0) == 0xE0) { // Starts with `1110' return 3; - } else if ((c & 0xF8) == 0xF0) { // Starts with `11110' + } + + if ((c & 0xF8) == 0xF0) { // Starts with `11110' return 4; } + return 0; } -- cgit v1.2.1