Re: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

Ni, Ray

Thanks for cleaning up the code to remove MdeModulePkg dependency.

Minor comments below:

UINTN NextIndex;
+ VOID *QuickSortBuffer;

1. Can you use local variable? "CPU_CACHE_INFO SortBuffer".

- PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+ QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+ if (QuickSortBuffer == NULL) {
+ }

2. With #1 change, you can avoid "calling AllocateZeroPool() and checking pointer".

+ QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, QuickSortBuffer);

3. Just pass "&SortBuffer" as the last parameter.

Join to automatically receive all group messages.