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
diff --git a/http/utility.hpp b/http/utility.hpp
index 431a2fe..d6f31d0 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -128,13 +128,15 @@
{
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));