From 77db2d84a392e627e29c2b6fddbea1ecc6b3b433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 22 Feb 2024 10:38:33 +0800 Subject: [PATCH] FFstrbuf: remove ffStrbufCompAlphabetically --- src/detection/disk/disk.c | 6 +++--- src/util/FFstrbuf.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/detection/disk/disk.c b/src/detection/disk/disk.c index 3e92ca0eb..e712a9c12 100644 --- a/src/detection/disk/disk.c +++ b/src/detection/disk/disk.c @@ -2,9 +2,9 @@ const char* ffDetectDisksImpl(FFlist* disks); -static int compareDisks(const void* disk1, const void* disk2) +static int compareDisks(const FFDisk* disk1, const FFDisk* disk2) { - return ffStrbufCompAlphabetically(&((const FFDisk*) disk1)->mountpoint, &((const FFDisk*) disk2)->mountpoint); + return ffStrbufComp(&disk1->mountpoint, &disk2->mountpoint); } const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks) @@ -18,7 +18,7 @@ const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks) // For example for /boot/efi/bootmgr we need to check /boot/efi before /boot //Note that we sort alphabetically here for a better ordering when printing the list, // so the check must be done in reverse order - ffListSort(disks, compareDisks); + ffListSort(disks, (void*) compareDisks); FF_LIST_FOR_EACH(FFDisk, disk, *disks) { if(disk->bytesTotal == 0) diff --git a/src/util/FFstrbuf.h b/src/util/FFstrbuf.h index 1eb6a3edd..d26e1fff5 100644 --- a/src/util/FFstrbuf.h +++ b/src/util/FFstrbuf.h @@ -300,11 +300,6 @@ static inline int ffStrbufComp(const FFstrbuf* strbuf, const FFstrbuf* comp) return memcmp(strbuf->chars, comp->chars, length + 1); } -static inline int ffStrbufCompAlphabetically(const FFstrbuf* strbuf, const FFstrbuf* comp) -{ - return strcmp(strbuf->chars, comp->chars); -} - static inline FF_C_NODISCARD bool ffStrbufEqual(const FFstrbuf* strbuf, const FFstrbuf* comp) { return ffStrbufComp(strbuf, comp) == 0;