diff options
author | David Robillard <d@drobilla.net> | 2020-12-22 15:29:14 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-22 15:29:14 +0100 |
commit | 85b5317faf502d6ab279c896a3f6351b21fd019a (patch) | |
tree | 5b961448e98a91fbd1edc9fbfe0aebaf592d9647 | |
parent | 680d41b239538b84ff33bf7448b2d49f3be85f47 (diff) | |
download | sratom-85b5317faf502d6ab279c896a3f6351b21fd019a.tar.gz sratom-85b5317faf502d6ab279c896a3f6351b21fd019a.tar.bz2 sratom-85b5317faf502d6ab279c896a3f6351b21fd019a.zip |
Avoid "else" after "return"
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | src/sratom.c | 29 |
2 files changed, 20 insertions, 10 deletions
diff --git a/.clang-tidy b/.clang-tidy index dafcdbb..7d10eb6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,5 @@ Checks: > *, - -*-else-after-return, -*-magic-numbers, -*-uppercase-literal-suffix, -bugprone-suspicious-string-compare, diff --git a/src/sratom.c b/src/sratom.c index f1d80a6..3bbe21d 100644 --- a/src/sratom.c +++ b/src/sratom.c @@ -229,13 +229,15 @@ number_type(const Sratom* sratom, const uint8_t* type) (!strcmp((const char*)type, (const char*)NS_XSD "int") || !strcmp((const char*)type, (const char*)NS_XSD "long"))) { return serd_node_from_string(SERD_URI, NS_XSD "integer"); - } else if (sratom->pretty_numbers && - (!strcmp((const char*)type, (const char*)NS_XSD "float") || - !strcmp((const char*)type, (const char*)NS_XSD "double"))) { + } + + if (sratom->pretty_numbers && + (!strcmp((const char*)type, (const char*)NS_XSD "float") || + !strcmp((const char*)type, (const char*)NS_XSD "double"))) { return serd_node_from_string(SERD_URI, NS_XSD "decimal"); - } else { - return serd_node_from_string(SERD_URI, type); } + + return serd_node_from_string(SERD_URI, type); } int @@ -556,15 +558,24 @@ atom_size(Sratom* sratom, uint32_t type_urid) { if (type_urid == sratom->forge.Int || type_urid == sratom->forge.Bool) { return sizeof(int32_t); - } else if (type_urid == sratom->forge.Long) { + } + + if (type_urid == sratom->forge.Long) { return sizeof(int64_t); - } else if (type_urid == sratom->forge.Float) { + } + + if (type_urid == sratom->forge.Float) { return sizeof(float); - } else if (type_urid == sratom->forge.Double) { + } + + if (type_urid == sratom->forge.Double) { return sizeof(double); - } else if (type_urid == sratom->forge.URID) { + } + + if (type_urid == sratom->forge.URID) { return sizeof(uint32_t); } + return 0; } |