From 85b5317faf502d6ab279c896a3f6351b21fd019a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 22 Dec 2020 15:29:14 +0100 Subject: Avoid "else" after "return" --- .clang-tidy | 1 - 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; } -- cgit v1.2.1