stringUtils: tidy

This commit is contained in:
李通洲
2024-01-11 16:27:53 +08:00
parent 0c65cdc1f5
commit 37e0a7b03f
3 changed files with 12 additions and 31 deletions
-1
View File
@@ -377,7 +377,6 @@ set(LIBFASTFETCH_SRC
src/util/FFlist.c
src/util/FFstrbuf.c
src/util/platform/FFPlatform.c
src/util/stringUtils.c
src/util/smbiosHelper.c
)
-28
View File
@@ -1,28 +0,0 @@
#include "stringUtils.h"
#include <ctype.h>
bool ffStrSet(const char* str)
{
if(str == NULL)
return false;
while(isspace(*str))
str++;
return *str != '\0';
}
bool ffStrHasNChars(const char* str, char c, uint32_t n)
{
for(uint32_t i = 0; i < n; i++)
{
char* current = strchr(str, c);
if(current == NULL)
return false;
str = current + 1;
}
return true;
}
+12 -2
View File
@@ -3,9 +3,19 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
static inline bool ffStrSet(const char* str)
{
if(str == NULL)
return false;
while(isspace(*str))
str++;
return *str != '\0';
}
bool ffStrSet(const char* str);
bool ffStrHasNChars(const char* str, char c, uint32_t n);
static inline bool ffStrStartsWithIgnCase(const char* str, const char* compareTo)
{