Skip to content

Commit b175905

Browse files
authored
Merge pull request #701 from stevebroshar/replace-pointer-comparison-with-null-checking
Use null check instead of pointer comparison
2 parents dcef17b + 7d0bcc8 commit b175905

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/unity.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,8 @@ void UnityAssertEqualString(const char* expected,
16091609
}
16101610
}
16111611
else
1612-
{ /* handle case of one pointers being null (if both null, test should pass) */
1613-
if (expected != actual)
1612+
{ /* fail if either null but not if both */
1613+
if (expected || actual)
16141614
{
16151615
Unity.CurrentTestFailed = 1;
16161616
}
@@ -1649,8 +1649,8 @@ void UnityAssertEqualStringLen(const char* expected,
16491649
}
16501650
}
16511651
else
1652-
{ /* handle case of one pointers being null (if both null, test should pass) */
1653-
if (expected != actual)
1652+
{ /* fail if either null but not if both */
1653+
if (expected || actual)
16541654
{
16551655
Unity.CurrentTestFailed = 1;
16561656
}

0 commit comments

Comments
 (0)