mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-01 10:32:35 +01:00
supprt for custom / multiple config dirs
This commit is contained in:
@@ -33,6 +33,17 @@ void* ffListAdd(FFlist* list)
|
||||
return adress;
|
||||
}
|
||||
|
||||
uint32_t ffListFirstIndexComp(FFlist* list, void* compElement, bool(*compFunc)(const void*, const void*))
|
||||
{
|
||||
for(uint32_t i = 0; i < list->length; i++)
|
||||
{
|
||||
if(compFunc(ffListGet(list, i), compElement))
|
||||
return i;
|
||||
}
|
||||
|
||||
return list->length;
|
||||
}
|
||||
|
||||
void ffListDestroy(FFlist* list)
|
||||
{
|
||||
free(list->data);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#ifndef FF_INCLUDED_FFLIST
|
||||
#define FF_INCLUDED_FFLIST
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define FF_LIST_DEFAULT_ALLOC 16
|
||||
@@ -22,6 +23,8 @@ void* ffListGet(FFlist* list, uint32_t index);
|
||||
|
||||
void* ffListAdd(FFlist* list);
|
||||
|
||||
uint32_t ffListFirstIndexComp(FFlist* list, void* compElement, bool(*compFunc)(const void*, const void*));
|
||||
|
||||
void ffListDestroy(FFlist* list);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-12
@@ -256,7 +256,7 @@ void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file)
|
||||
|
||||
int ffStrbufComp(const FFstrbuf* strbuf, const FFstrbuf* comp)
|
||||
{
|
||||
return ffStrbufCompNS(strbuf, comp->length, comp->chars);
|
||||
return ffStrbufCompS(strbuf, comp->chars);
|
||||
}
|
||||
|
||||
int ffStrbufCompS(const FFstrbuf* strbuf, const char* comp)
|
||||
@@ -264,14 +264,9 @@ int ffStrbufCompS(const FFstrbuf* strbuf, const char* comp)
|
||||
return strcmp(strbuf->chars, comp);
|
||||
}
|
||||
|
||||
int ffStrbufCompNS(const FFstrbuf* strbuf, uint32_t length, const char* comp)
|
||||
{
|
||||
return strncasecmp(strbuf->chars, comp, length);
|
||||
}
|
||||
|
||||
int ffStrbufIgnCaseComp(const FFstrbuf* strbuf, const FFstrbuf* comp)
|
||||
{
|
||||
return ffStrbufIgnCaseCompNS(strbuf, comp->length, comp->chars);
|
||||
return ffStrbufIgnCaseCompS(strbuf, comp->chars);
|
||||
}
|
||||
|
||||
int ffStrbufIgnCaseCompS(const FFstrbuf* strbuf, const char* comp)
|
||||
@@ -279,11 +274,6 @@ int ffStrbufIgnCaseCompS(const FFstrbuf* strbuf, const char* comp)
|
||||
return strcasecmp(strbuf->chars, comp);
|
||||
}
|
||||
|
||||
int ffStrbufIgnCaseCompNS(const FFstrbuf* strbuf, uint32_t length, const char* comp)
|
||||
{
|
||||
return strncasecmp(strbuf->chars, comp, length);
|
||||
}
|
||||
|
||||
void ffStrbufTrimLeft(FFstrbuf* strbuf, char c)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
|
||||
@@ -58,11 +58,9 @@ void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file);
|
||||
|
||||
int ffStrbufComp(const FFstrbuf* strbuf, const FFstrbuf* comp);
|
||||
int ffStrbufCompS(const FFstrbuf* strbuf, const char* comp);
|
||||
int ffStrbufCompNS(const FFstrbuf* strbuf, uint32_t length, const char* comp);
|
||||
|
||||
int ffStrbufIgnCaseComp(const FFstrbuf* strbuf, const FFstrbuf* comp);
|
||||
int ffStrbufIgnCaseCompS(const FFstrbuf* strbuf, const char* comp);
|
||||
int ffStrbufIgnCaseCompNS(const FFstrbuf* strbuf, uint32_t length, const char* comp);
|
||||
|
||||
void ffStrbufTrimLeft(FFstrbuf* strbuf, char c);
|
||||
void ffStrbufTrimRight(FFstrbuf* strbuf, char c);
|
||||
|
||||
Reference in New Issue
Block a user