From 66a110d7c9a63aea280253de4d242e4a9037d4c3 Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Tue, 21 Jan 2014 07:34:41 +0000 Subject: [PATCH] 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 --- MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.39.2