summaryrefslogtreecommitdiff
path: root/MdePkg/Library/UefiDevicePathLib
diff options
context:
space:
mode:
authorRuiyu Ni <ruyu.ni@intel.com>2014-01-21 07:34:41 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-21 07:34:41 +0000
commit66a110d7c9a63aea280253de4d242e4a9037d4c3 (patch)
tree7b5b28932582e9ae373bce4786578aa947da81a7 /MdePkg/Library/UefiDevicePathLib
parent2d441ca9cd79aae0d26ee7f464ddbee2a28d2121 (diff)
downloadedk2-platforms-66a110d7c9a63aea280253de4d242e4a9037d4c3.tar.xz
Optimize the code to not call StrToBuf when DataLength is 0.
Signed-off-by: Ruiyu Ni <ruyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15143 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c4
1 files changed, 3 insertions, 1 deletions
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;
}