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-10-04 20:13:50 +01:00 committed by Tim Edwards
parent 6a513d01a1
commit 6eff1c2132
1 changed files with 3 additions and 0 deletions

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)