mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 12:14:19 +01:00
Global: refactor strcasecmp() == 0 to ffStrEqualsIgnCase()
to prevent me from forgetting to write `== 0`
This commit is contained in:
@@ -5,8 +5,29 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
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)
|
||||
{
|
||||
return strncasecmp(str, compareTo, strlen(compareTo)) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrEqualsIgnCase(const char* str, const char* compareTo)
|
||||
{
|
||||
return strcasecmp(str, compareTo) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrStartsWith(const char* str, const char* compareTo)
|
||||
{
|
||||
return strncmp(str, compareTo, strlen(compareTo)) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrEquals(const char* str, const char* compareTo)
|
||||
{
|
||||
return strcmp(str, compareTo) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user