mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
small syntactic changes
This commit is contained in:
+5
-5
@@ -292,23 +292,24 @@ void ffCacheClose(FFcache* cache)
|
||||
|
||||
bool ffParsePropFile(const char* fileName, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
FILE* file = fopen(fileName, "r");
|
||||
if(file == NULL)
|
||||
return false; // handle errors in higher functions
|
||||
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
while (getline(&line, &len, file) != -1)
|
||||
{
|
||||
if(ffGetPropValue(line, start, buffer))
|
||||
break;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
if(line != NULL)
|
||||
free(line);
|
||||
|
||||
fclose(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -329,7 +330,6 @@ bool ffParsePropFileHome(FFinstance* instance, const char* relativeFile, const c
|
||||
|
||||
bool ffParsePropFileConfig(FFinstance* instance, const char* relativeFile, const char* start, FFstrbuf* buffer)
|
||||
{
|
||||
|
||||
uint32_t bufferLengthStart = buffer->length;
|
||||
bool foundAFile = false;
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ static inline void printHelp()
|
||||
" -l <name>, --logo <name>: sets the shown logo. Also changes the main color accordingly\n"
|
||||
" --color-logo <?value>: if set to false, the logo will be black / white\n"
|
||||
"\n"
|
||||
"Format options: Provide the format string for custom output (+)\n"
|
||||
"Format options: Provide the format string for custom output. Use fastfetch --help *-format for specific help.\n"
|
||||
" --os-format <format>\n"
|
||||
" --host-format <format>\n"
|
||||
" --kernel-format <format>\n"
|
||||
|
||||
+3
-2
@@ -54,10 +54,11 @@ void ffPrintGPU(FFinstance* instance)
|
||||
if(ffPrintFromCache(instance, FF_GPU_MODULE_NAME, &instance->config.gpuKey, &instance->config.gpuFormat, FF_GPU_NUM_FORMAT_ARGS))
|
||||
return;
|
||||
|
||||
void* pci = dlopen(instance->config.libPCI.length == 0 ? "libpci.so" : instance->config.libPCI.chars, RTLD_LAZY);
|
||||
const char* pciLibName = instance->config.libPCI.length == 0 ? "libpci.so" : instance->config.libPCI.chars;
|
||||
void* pci = dlopen(pciLibName, RTLD_LAZY);
|
||||
if(pci == NULL)
|
||||
{
|
||||
ffPrintError(instance, FF_GPU_MODULE_NAME, 0, &instance->config.gpuKey, &instance->config.gpuFormat, FF_GPU_NUM_FORMAT_ARGS, "dlopen(\"libpci.so\", RTLD_LAZY) == NULL");
|
||||
ffPrintError(instance, FF_GPU_MODULE_NAME, 0, &instance->config.gpuKey, &instance->config.gpuFormat, FF_GPU_NUM_FORMAT_ARGS, "dlopen(\"%s\", RTLD_LAZY) == NULL", pciLibName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
#define FF_PACKAGES_MODULE_NAME "Packages"
|
||||
#define FF_PACKAGES_NUM_FORMAT_ARGS 7
|
||||
|
||||
static uint32_t getNumElements(const char* dirname, unsigned char type) {
|
||||
uint32_t num_elements = 0;
|
||||
DIR * dirp;
|
||||
struct dirent *entry;
|
||||
|
||||
dirp = opendir(dirname);
|
||||
static uint32_t getNumElements(const char* dirname, unsigned char type)
|
||||
{
|
||||
DIR* dirp = opendir(dirname);
|
||||
if(dirp == NULL)
|
||||
return 0;
|
||||
|
||||
uint32_t num_elements = 0;
|
||||
|
||||
struct dirent *entry;
|
||||
while((entry = readdir(dirp)) != NULL) {
|
||||
if(entry->d_type == type)
|
||||
++num_elements;
|
||||
|
||||
@@ -35,10 +35,11 @@ static void xCloseDisplay(void* library, Display* display)
|
||||
|
||||
void ffPrintResolutionX11Backend(FFinstance* instance)
|
||||
{
|
||||
void* x11 = dlopen(instance->config.libX11.length == 0 ? "libX11.so" : instance->config.libX11.chars, RTLD_LAZY);
|
||||
const char* libX11Name = instance->config.libX11.length == 0 ? "libX11.so" : instance->config.libX11.chars;
|
||||
void* x11 = dlopen(libX11Name, RTLD_LAZY);
|
||||
if(x11 == NULL)
|
||||
{
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.resolutionKey, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS, "dlopen(\"libX11.so\", RTLD_LAZY) == NULL");
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.resolutionKey, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS, "dlopen(\"%s\", RTLD_LAZY) == NULL", libX11Name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user