aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-02 21:52:20 +0100
committerDavid Robillard <d@drobilla.net>2021-01-02 21:52:20 +0100
commit59296974c71dfc7db7d003b40af84fa36a5e93c6 (patch)
treeda05c022c534e8bd1d2800310e9c80c4d98c6046 /src
parent416478739315ca41ad236197b25f87b83ab7f312 (diff)
downloadpugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.gz
pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.bz2
pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.zip
Avoid "else" after "return"
Diffstat (limited to 'src')
-rw-r--r--src/.clang-tidy2
-rw-r--r--src/implementation.c17
-rw-r--r--src/x11.c8
3 files changed, 18 insertions, 9 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 808cbb1..11b620e 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -11,9 +11,7 @@ Checks: >
-clang-diagnostic-unused-macros,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
- -llvm-else-after-return,
-llvm-header-guard,
-llvmlibc-*,
- -readability-else-after-return,
FormatStyle: file
HeaderFilterRegex: 'pugl/.*'
diff --git a/src/implementation.c b/src/implementation.c
index a6d8393..79ac5d6 100644
--- a/src/implementation.c
+++ b/src/implementation.c
@@ -320,19 +320,27 @@ puglDecodeUTF8(const uint8_t* buf)
if (buf[0] < 0x80) {
return buf[0];
- } else if (buf[0] < 0xC2) {
+ }
+
+ if (buf[0] < 0xC2) {
return 0xFFFD;
- } else if (buf[0] < 0xE0) {
+ }
+
+ if (buf[0] < 0xE0) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u;
- } else if (buf[0] < 0xF0) {
+ }
+
+ if (buf[0] < 0xF0) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0);
FAIL_IF((buf[2] & 0xC0u) != 0x80);
return ((uint32_t)buf[0] << 12u) + //
((uint32_t)buf[1] << 6u) + //
((uint32_t)buf[2] - 0xE2080u);
- } else if (buf[0] < 0xF5) {
+ }
+
+ if (buf[0] < 0xF5) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90);
FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90);
@@ -343,6 +351,7 @@ puglDecodeUTF8(const uint8_t* buf)
((uint32_t)buf[2] << 6u) + //
((uint32_t)buf[3] - 0x3C82080u));
}
+
return 0xFFFD;
}
diff --git a/src/x11.c b/src/x11.c
index 2b594b7..a422e73 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -278,7 +278,9 @@ puglRealize(PuglView* view)
// Ensure that we're unrealized and that a reasonable backend has been set
if (impl->win) {
return PUGL_FAILURE;
- } else if (!view->backend || !view->backend->configure) {
+ }
+
+ if (!view->backend || !view->backend->configure) {
return PUGL_BAD_BACKEND;
}
@@ -902,9 +904,9 @@ puglSendEvent(PuglView* view, const PuglEvent* event)
if (xev.type) {
if (XSendEvent(view->impl->display, view->impl->win, False, 0, &xev)) {
return PUGL_SUCCESS;
- } else {
- return PUGL_UNKNOWN_ERROR;
}
+
+ return PUGL_UNKNOWN_ERROR;
}
return PUGL_UNSUPPORTED_TYPE;