/** @file\r
Library used for sorting routines.\r
\r
- Copyright (c) 2009-2010, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
if ( Count < 2\r
|| ElementSize < 1\r
- ){\r
+ ){\r
return;\r
}\r
\r
for ( LoopCount = 0\r
; LoopCount < Count -1\r
; LoopCount++\r
- ){\r
+ ){\r
//\r
// if the element is less than the pivot\r
//\r
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element\r
// IE list is sorted left half, pivot element, sorted right half...\r
//\r
- QuickSortWorker(\r
- BufferToSort,\r
- NextSwapLocation,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
-\r
- QuickSortWorker(\r
- (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
- Count - NextSwapLocation - 1,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
+ if (NextSwapLocation >= 2) {\r
+ QuickSortWorker(\r
+ BufferToSort,\r
+ NextSwapLocation,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
\r
+ if ((Count - NextSwapLocation - 1) >= 2) {\r
+ QuickSortWorker(\r
+ (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
+ Count - NextSwapLocation - 1,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
return;\r
}\r
/**\r
ASSERT(BufferToSort != NULL);\r
ASSERT(CompareFunction != NULL);\r
\r
- Buffer = AllocatePool(ElementSize);\r
+ Buffer = AllocateZeroPool(ElementSize);\r
ASSERT(Buffer != NULL);\r
\r
QuickSortWorker(\r
/**\r
Not supported in Base version.\r
\r
+ @param[in] Buffer1 Ignored.\r
+ @param[in] Buffer2 Ignored.\r
+\r
ASSERT and return 0.\r
**/\r
INTN\r
+EFIAPI\r
DevicePathCompare (\r
IN CONST VOID *Buffer1,\r
IN CONST VOID *Buffer2\r
}\r
\r
\r
+/**\r
+ Function to compare 2 strings.\r
+\r
+ @param[in] Buffer1 Pointer to String to compare (CHAR16**).\r
+ @param[in] Buffer2 Pointer to second String to compare (CHAR16**).\r
+\r
+ @retval 0 Buffer1 equal to Buffer2.\r
+ @return < 0 Buffer1 is less than Buffer2.\r
+ @return > 0 Buffer1 is greater than Buffer2.\r
+**/\r
+INTN\r
+EFIAPI\r
+StringCompare (\r
+ IN CONST VOID *Buffer1,\r
+ IN CONST VOID *Buffer2\r
+ )\r
+{\r
+ ASSERT(FALSE);\r
+ return 0;\r
+}\r
+\r
+\r