extflat/EFname.c: EFHNBest() add argument ASSERT to convey intention

Adding ASSERT() to arguments to ensure passed arguments are non-NULL
better conveys API intent to both mitigate this false positive
but also allow analysis to inspect caller for correct usage.

SonarCloud
Null pointer passed as 1st argument to string length function
https://sonarcloud.io/project/issues?open=AZJB167jNGfDNup0RjGw&id=dlmiles_magic
This commit is contained in:
Darryl L. Miles
2024-12-26 13:01:24 -05:00
committed by Tim Edwards
parent 6a513d01a1
commit 6eff1c2132
+3
View File
@@ -508,6 +508,9 @@ EFHNBest(hierName1, hierName2)
HierName *np1, *np2;
char last1, last2;
ASSERT(hierName1, "hierName1");
ASSERT(hierName2, "hierName2");
for (ncomponents1 = 0, np1 = hierName1; np1; np1 = np1->hn_parent)
ncomponents1++;
for (ncomponents2 = 0, np2 = hierName2; np2; np2 = np2->hn_parent)