summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/UefiSortLib/UefiSortLib.c')
-rw-r--r--MdeModulePkg/Library/UefiSortLib/UefiSortLib.c109
1 files changed, 58 insertions, 51 deletions
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 29d8735c22..0ba1244930 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
@@ -19,7 +19,7 @@
#include <Library/SortLib.h>
#include <Library/DevicePathLib.h>
-STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
+STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
#define USL_FREE_NON_NULL(Pointer) \
{ \
@@ -50,19 +50,19 @@ STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
VOID
EFIAPI
PerformQuickSort (
- IN OUT VOID *BufferToSort,
- IN CONST UINTN Count,
- IN CONST UINTN ElementSize,
- IN SORT_COMPARE CompareFunction
+ IN OUT VOID *BufferToSort,
+ IN CONST UINTN Count,
+ IN CONST UINTN ElementSize,
+ IN SORT_COMPARE CompareFunction
)
{
VOID *Buffer;
- ASSERT(BufferToSort != NULL);
- ASSERT(CompareFunction != NULL);
+ ASSERT (BufferToSort != NULL);
+ ASSERT (CompareFunction != NULL);
- Buffer = AllocateZeroPool(ElementSize);
- ASSERT(Buffer != NULL);
+ Buffer = AllocateZeroPool (ElementSize);
+ ASSERT (Buffer != NULL);
QuickSort (
BufferToSort,
@@ -72,7 +72,7 @@ PerformQuickSort (
Buffer
);
- FreePool(Buffer);
+ FreePool (Buffer);
return;
}
@@ -89,8 +89,8 @@ PerformQuickSort (
INTN
EFIAPI
DevicePathCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath1;
@@ -100,8 +100,8 @@ DevicePathCompare (
EFI_STATUS Status;
INTN RetVal;
- DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer1;
- DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer2;
+ DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL **)Buffer1;
+ DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL **)Buffer2;
if (DevicePath1 == NULL) {
if (DevicePath2 == NULL) {
@@ -116,37 +116,41 @@ DevicePathCompare (
}
if (mUnicodeCollation == NULL) {
- Status = gBS->LocateProtocol(
- &gEfiUnicodeCollation2ProtocolGuid,
- NULL,
- (VOID**)&mUnicodeCollation);
+ Status = gBS->LocateProtocol (
+ &gEfiUnicodeCollation2ProtocolGuid,
+ NULL,
+ (VOID **)&mUnicodeCollation
+ );
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
}
- TextPath1 = ConvertDevicePathToText(
- DevicePath1,
- FALSE,
- FALSE);
+ TextPath1 = ConvertDevicePathToText (
+ DevicePath1,
+ FALSE,
+ FALSE
+ );
- TextPath2 = ConvertDevicePathToText(
- DevicePath2,
- FALSE,
- FALSE);
+ TextPath2 = ConvertDevicePathToText (
+ DevicePath2,
+ FALSE,
+ FALSE
+ );
if (TextPath1 == NULL) {
RetVal = -1;
} else if (TextPath2 == NULL) {
RetVal = 1;
} else {
- RetVal = mUnicodeCollation->StriColl(
- mUnicodeCollation,
- TextPath1,
- TextPath2);
+ RetVal = mUnicodeCollation->StriColl (
+ mUnicodeCollation,
+ TextPath1,
+ TextPath2
+ );
}
- USL_FREE_NON_NULL(TextPath1);
- USL_FREE_NON_NULL(TextPath2);
+ USL_FREE_NON_NULL (TextPath1);
+ USL_FREE_NON_NULL (TextPath2);
return (RetVal);
}
@@ -164,27 +168,29 @@ DevicePathCompare (
INTN
EFIAPI
StringNoCaseCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+
if (mUnicodeCollation == NULL) {
- Status = gBS->LocateProtocol(
- &gEfiUnicodeCollation2ProtocolGuid,
- NULL,
- (VOID**)&mUnicodeCollation);
+ Status = gBS->LocateProtocol (
+ &gEfiUnicodeCollation2ProtocolGuid,
+ NULL,
+ (VOID **)&mUnicodeCollation
+ );
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
}
- return (mUnicodeCollation->StriColl(
- mUnicodeCollation,
- *(CHAR16**)Buffer1,
- *(CHAR16**)Buffer2));
+ return (mUnicodeCollation->StriColl (
+ mUnicodeCollation,
+ *(CHAR16 **)Buffer1,
+ *(CHAR16 **)Buffer2
+ ));
}
-
/**
Function to compare 2 strings.
@@ -198,11 +204,12 @@ StringNoCaseCompare (
INTN
EFIAPI
StringCompare (
- IN CONST VOID *Buffer1,
- IN CONST VOID *Buffer2
+ IN CONST VOID *Buffer1,
+ IN CONST VOID *Buffer2
)
{
- return (StrCmp(
- *(CHAR16**)Buffer1,
- *(CHAR16**)Buffer2));
+ return (StrCmp (
+ *(CHAR16 **)Buffer1,
+ *(CHAR16 **)Buffer2
+ ));
}