Reviewed-by: Ye Ting <ting...@intel.com> -----Original Message----- From: Wu, Jiaxin Sent: Tuesday, January 05, 2016 9:47 AM To: edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan Subject: [Patch] NetworkPkg: Removing or adding some ASSERT statement
Refine the code by removing or adding some ASSERT statement to make the code more readable. Cc: Ye Ting <ting...@intel.com> Cc: Fu Siyuan <siyuan...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> --- NetworkPkg/DnsDxe/DnsImpl.c | 4 ---- NetworkPkg/DnsDxe/DnsProtocol.c | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/DnsDxe/DnsImpl.c b/NetworkPkg/DnsDxe/DnsImpl.c index 8725670..823bcf3 100644 --- a/NetworkPkg/DnsDxe/DnsImpl.c +++ b/NetworkPkg/DnsDxe/DnsImpl.c @@ -1358,12 +1358,10 @@ ParseDnsResponse ( // // Check whether it's the GeneralLookUp querying. // if (Instance->Service->IpVersion == IP_VERSION_4 && Dns4TokenEntry->GeneralLookUp) { - ASSERT (Dns4TokenEntry != NULL); - Dns4RR = Dns4TokenEntry->Token->RspData.GLookupData->RRList; AnswerData = (UINT8 *) AnswerSection + sizeof (*AnswerSection); // // Fill the ResourceRecord. @@ -1385,12 +1383,10 @@ ParseDnsResponse ( } CopyMem (Dns4RR[RRCount].RData, AnswerData, Dns4RR[RRCount].DataLength); RRCount ++; } else if (Instance->Service->IpVersion == IP_VERSION_6 && Dns6TokenEntry->GeneralLookUp) { - ASSERT (Dns6TokenEntry != NULL); - Dns6RR = Dns6TokenEntry->Token->RspData.GLookupData->RRList; AnswerData = (UINT8 *) AnswerSection + sizeof (*AnswerSection); // // Fill the ResourceRecord. diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index e7aa227..a3f3de9 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -460,10 +460,12 @@ Dns4HostNameToIp ( } goto ON_EXIT; } + ASSERT (Packet != NULL); + // // Save the token into the Dns4TxTokens map. // Status = NetMapInsertTail (&Instance->Dns4TxTokens, TokenEntry, Packet); if (EFI_ERROR (Status)) { @@ -633,10 +635,12 @@ Dns4GeneralLookUp ( } goto ON_EXIT; } + ASSERT (Packet != NULL); + // // Save the token into the Dns4TxTokens map. // Status = NetMapInsertTail (&Instance->Dns4TxTokens, TokenEntry, Packet); if (EFI_ERROR (Status)) { @@ -1229,10 +1233,12 @@ Dns6HostNameToIp ( } goto ON_EXIT; } + ASSERT (Packet != NULL); + // // Save the token into the Dns6TxTokens map. // Status = NetMapInsertTail (&Instance->Dns6TxTokens, TokenEntry, Packet); if (EFI_ERROR (Status)) { @@ -1402,10 +1408,12 @@ Dns6GeneralLookUp ( } goto ON_EXIT; } + ASSERT (Packet != NULL); + // // Save the token into the Dns6TxTokens map. // Status = NetMapInsertTail (&Instance->Dns6TxTokens, TokenEntry, Packet); if (EFI_ERROR (Status)) { -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel