summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-12-10 13:54:51 -0500
committerDavid Robillard <d@drobilla.net>2022-12-10 19:04:45 -0500
commit0791512fb1d73ea63c98f3f68327dc543e214850 (patch)
tree034a6028b0c9215bd234a3ad95ce2c8ce2609f21
parentb917c984b15a9583326fa6318be6632850817994 (diff)
downloadlilv-0791512fb1d73ea63c98f3f68327dc543e214850.tar.gz
lilv-0791512fb1d73ea63c98f3f68327dc543e214850.tar.bz2
lilv-0791512fb1d73ea63c98f3f68327dc543e214850.zip
Avoid cloned conditional branches
-rw-r--r--src/.clang-tidy1
-rw-r--r--src/query.c7
-rw-r--r--src/util.c7
3 files changed, 4 insertions, 11 deletions
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 21665f3..12ca76c 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -4,7 +4,6 @@
Checks: >
-*-magic-numbers,
-android-cloexec-fopen,
- -bugprone-branch-clone,
-bugprone-narrowing-conversions,
-cert-err33-c,
-cert-err34-c,
diff --git a/src/query.c b/src/query.c
index 5d916d6..3dd8eca 100644
--- a/src/query.c
+++ b/src/query.c
@@ -83,12 +83,7 @@ lilv_nodes_from_stream_objects_i18n(LilvWorld* world,
}
const SordNode* best = nolang;
- if (syslang && partial) {
- // Partial language match for system language
- best = partial;
- } else if (!best) {
- // No languages matches at all, and no untranslated value
- // Use any value, if possible
+ if ((syslang && partial) || !best) {
best = partial;
}
diff --git a/src/util.c b/src/util.c
index ef56797..b5aed50 100644
--- a/src/util.c
+++ b/src/util.c
@@ -116,10 +116,9 @@ lilv_get_lang(void)
lang[i] = '-'; // Convert _ to -
} else if (env_lang[i] >= 'A' && env_lang[i] <= 'Z') {
lang[i] = env_lang[i] + ('a' - 'A'); // Convert to lowercase
- } else if (env_lang[i] >= 'a' && env_lang[i] <= 'z') {
- lang[i] = env_lang[i]; // Lowercase letter, copy verbatim
- } else if (env_lang[i] >= '0' && env_lang[i] <= '9') {
- lang[i] = env_lang[i]; // Digit, copy verbatim
+ } else if ((env_lang[i] >= 'a' && env_lang[i] <= 'z') ||
+ (env_lang[i] >= '0' && env_lang[i] <= '9')) {
+ lang[i] = env_lang[i]; // Lowercase letter or digit, copy verbatim
} else if (env_lang[i] == '\0' || env_lang[i] == '.') {
// End, or start of suffix (e.g. en_CA.utf-8), finished
lang[i] = '\0';