diff options
author | David Robillard <d@drobilla.net> | 2020-09-27 15:43:44 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-09-27 15:43:44 +0200 |
commit | 0ab07d65fe9261ecfa495090691db324eff7aefc (patch) | |
tree | 24f90131d01039374ecdabab6008d734a762bedd | |
parent | efbc456d41a634aa9b89b0333b26071f503bd5f3 (diff) | |
download | suil-0ab07d65fe9261ecfa495090691db324eff7aefc.tar.gz suil-0ab07d65fe9261ecfa495090691db324eff7aefc.tar.bz2 suil-0ab07d65fe9261ecfa495090691db324eff7aefc.zip |
Don't use else after return or break
Normally I don't enable this once, since it's often silly, but here it does
actually make things more readable.
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | src/instance.c | 59 |
2 files changed, 32 insertions, 28 deletions
diff --git a/.clang-tidy b/.clang-tidy index 67e8ba9..5138f6f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -6,7 +6,6 @@ Checks: > -clang-analyzer-core.CallAndMessage, -hicpp-signed-bitwise, -llvm-header-guard, - -readability-else-after-return, -readability-non-const-parameter, WarningsAsErrors: '*' HeaderFilterRegex: '.*' diff --git a/src/instance.c b/src/instance.c index fd0aea2..9235f6e 100644 --- a/src/instance.c +++ b/src/instance.c @@ -46,36 +46,39 @@ suil_ui_supported(const char* host_type_uri, SUIL_WRAPPING_NATIVE = 1, SUIL_WRAPPING_EMBEDDED = 2 }; + if (!strcmp(host_type_uri, ui_type_uri)) { return SUIL_WRAPPING_NATIVE; - } else if ((!strcmp(host_type_uri, GTK2_UI_URI) - && !strcmp(ui_type_uri, QT4_UI_URI)) - || (!strcmp(host_type_uri, GTK2_UI_URI) - && !strcmp(ui_type_uri, QT5_UI_URI)) - || (!strcmp(host_type_uri, QT4_UI_URI) - && !strcmp(ui_type_uri, GTK2_UI_URI)) - || (!strcmp(host_type_uri, QT5_UI_URI) - && !strcmp(ui_type_uri, GTK2_UI_URI)) - || (!strcmp(host_type_uri, GTK2_UI_URI) - && !strcmp(ui_type_uri, X11_UI_URI)) - || (!strcmp(host_type_uri, GTK3_UI_URI) - && !strcmp(ui_type_uri, X11_UI_URI)) - || (!strcmp(host_type_uri, GTK3_UI_URI) - && !strcmp(ui_type_uri, QT5_UI_URI)) - || (!strcmp(host_type_uri, GTK2_UI_URI) - && !strcmp(ui_type_uri, WIN_UI_URI)) - || (!strcmp(host_type_uri, GTK2_UI_URI) - && !strcmp(ui_type_uri, COCOA_UI_URI)) - || (!strcmp(host_type_uri, QT4_UI_URI) - && !strcmp(ui_type_uri, X11_UI_URI)) - || (!strcmp(host_type_uri, QT5_UI_URI) - && !strcmp(ui_type_uri, X11_UI_URI)) - || (!strcmp(host_type_uri, QT5_UI_URI) - && !strcmp(ui_type_uri, COCOA_UI_URI))) { + } + + if ((!strcmp(host_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, QT4_UI_URI)) + || (!strcmp(host_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, QT5_UI_URI)) + || (!strcmp(host_type_uri, QT4_UI_URI) + && !strcmp(ui_type_uri, GTK2_UI_URI)) + || (!strcmp(host_type_uri, QT5_UI_URI) + && !strcmp(ui_type_uri, GTK2_UI_URI)) + || (!strcmp(host_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, X11_UI_URI)) + || (!strcmp(host_type_uri, GTK3_UI_URI) + && !strcmp(ui_type_uri, X11_UI_URI)) + || (!strcmp(host_type_uri, GTK3_UI_URI) + && !strcmp(ui_type_uri, QT5_UI_URI)) + || (!strcmp(host_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, WIN_UI_URI)) + || (!strcmp(host_type_uri, GTK2_UI_URI) + && !strcmp(ui_type_uri, COCOA_UI_URI)) + || (!strcmp(host_type_uri, QT4_UI_URI) + && !strcmp(ui_type_uri, X11_UI_URI)) + || (!strcmp(host_type_uri, QT5_UI_URI) + && !strcmp(ui_type_uri, X11_UI_URI)) + || (!strcmp(host_type_uri, QT5_UI_URI) + && !strcmp(ui_type_uri, COCOA_UI_URI))) { return SUIL_WRAPPING_EMBEDDED; - } else { - return SUIL_WRAPPING_UNSUPPORTED; } + + return SUIL_WRAPPING_UNSUPPORTED; } static SuilWrapper* @@ -228,7 +231,9 @@ suil_instance_new(SuilHost* host, const LV2UI_Descriptor* ld = df(i); if (!ld) { break; - } else if (!strcmp(ld->URI, ui_uri)) { + } + + if (!strcmp(ld->URI, ui_uri)) { descriptor = ld; break; } |