Short-circuit on reference equality in ValueEquals and JValue.Compare
Covers the both-null case previously checked for, so no extra cost, and skips all further work. Also make two `is` checks a null-check after `as`.
This commit is contained in:
@@ -39,15 +39,11 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
public static bool ValueEquals(object objA, object objB)
|
||||
{
|
||||
if (objA == null && objB == null)
|
||||
if (objA == objB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (objA != null && objB == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (objA == null && objB != null)
|
||||
if (objA == null || objB == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user