From: Ruiyu Ni Date: Tue, 21 Jan 2014 07:34:41 +0000 (+0000) Subject: Optimize the code to not call StrToBuf when DataLength is 0. X-Git-Tag: edk2-stable201903~11814 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=66a110d7c9a63aea280253de4d242e4a9037d4c3 Optimize the code to not call StrToBuf when DataLength is 0. Signed-off-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15143 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c index 008ec0b96c..37d7a1752b 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -567,7 +567,9 @@ DevPathFromTextGenericPath ( (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength) ); - StrToBuf ((UINT8 *) (Node + 1), DataLength, DataStr); + if (DataLength != 0) { + StrToBuf ((UINT8 *) (Node + 1), DataLength, DataStr); + } return Node; }