summaryrefslogtreecommitdiff
path: root/http/utility.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-06-29 05:53:24 +0300
committerEd Tanous <ed@tanous.net>2022-07-14 18:20:10 +0300
commitef641b657486ed7d4003ec8c2b0d0329cda288b8 (patch)
treea6e71494f7daabef48fdbd2228b7ea1b58a98835 /http/utility.hpp
parentb5a10a22db6f44c7a96cc2912e1b57db439e77fc (diff)
downloadbmcweb-ef641b657486ed7d4003ec8c2b0d0329cda288b8.tar.xz
Simplify logic in router matcher
cppcheck takes a little issue with this logic having some redundancies in it. Regardless of that, it's kind of hard to read; Rearrange the logic so it's easier to read and add comments. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I0251ceb511e1bc62260b68c430b272d02b90fcb7
Diffstat (limited to 'http/utility.hpp')
-rw-r--r--http/utility.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/http/utility.hpp b/http/utility.hpp
index 431a2fe40b..d6f31d0717 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -128,13 +128,15 @@ inline bool isParameterTagCompatible(uint64_t a, uint64_t b)
{
while (true)
{
- if (a == 0)
+ if (a == 0 && b == 0)
{
- return b == 0;
+ // Both tags were equivalent, parameters are compatible
+ return true;
}
- if (b == 0)
+ if (a == 0 || b == 0)
{
- return a == 0;
+ // one of the tags had more parameters than the other
+ return false;
}
TypeCode sa = static_cast<TypeCode>(a % toUnderlying(TypeCode::Max));
TypeCode sb = static_cast<TypeCode>(b % toUnderlying(TypeCode::Max));