mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
better FF_UNUSED
This commit is contained in:
@@ -223,7 +223,7 @@ static void getShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* versio
|
||||
|
||||
const FFTerminalShellResult* ffDetectTerminalShell(FFinstance* instance)
|
||||
{
|
||||
UNUSED(instance);
|
||||
FF_UNUSED(instance);
|
||||
|
||||
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static FFTerminalShellResult result;
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ void ffStart(FFinstance* instance)
|
||||
|
||||
static void ffCleanup(FFinstance* instance)
|
||||
{
|
||||
UNUSED(instance);
|
||||
FF_UNUSED(instance);
|
||||
// Place for cleaning up
|
||||
// I dont destroy the global strbufs, because the OS is typically faster doing it after the program terminates
|
||||
// This eliminates one function call per strbuf + setting things like length to 0
|
||||
|
||||
@@ -131,6 +131,7 @@ FFvariant ffSettingsGetGSettings(FFinstance* instance, const char* schemaName, c
|
||||
#else //FF_HAVE_GIO
|
||||
FFvariant ffSettingsGetGSettings(FFinstance* instance, const char* schemaName, const char* path, const char* key, FFvarianttype type)
|
||||
{
|
||||
FF_UNUSED(instance, schemaName, path, key, type)
|
||||
return FF_VARIANT_NULL;
|
||||
}
|
||||
#endif //FF_HAVE_GIO
|
||||
@@ -196,6 +197,7 @@ FFvariant ffSettingsGetDConf(FFinstance* instance, const char* key, FFvarianttyp
|
||||
#else //FF_HAVE_DCONF
|
||||
FFvariant ffSettingsGetDConf(FFinstance* instance, const char* key, FFvarianttype type)
|
||||
{
|
||||
FF_UNUSED(instance, key, type)
|
||||
return FF_VARIANT_NULL;
|
||||
}
|
||||
#endif //FF_HAVE_DCONF
|
||||
@@ -283,6 +285,7 @@ FFvariant ffSettingsGetXFConf(FFinstance* instance, const char* channelName, con
|
||||
#else //FF_HAVE_XFCONF
|
||||
FFvariant ffSettingsGetXFConf(FFinstance* instance, const char* channelName, const char* propertyName, FFvarianttype type)
|
||||
{
|
||||
FF_UNUSED(instance, channelName, propertyName, type)
|
||||
return FF_VARIANT_NULL;
|
||||
}
|
||||
#endif //FF_HAVE_XFCONF
|
||||
@@ -384,6 +387,7 @@ uint32_t ffSettingsGetSQLiteColumnCount(FFinstance* instance, const char* fileNa
|
||||
#else //FF_HAVE_SQLITE3
|
||||
uint32_t ffSettingsGetSQLiteColumnCount(FFinstance* instance, const char* fileName, const char* tableName)
|
||||
{
|
||||
FF_UNUSED(instance, fileName, tableName);
|
||||
return 0;
|
||||
}
|
||||
#endif //FF_HAVE_SQLITE3
|
||||
|
||||
+2
-1
@@ -18,7 +18,8 @@
|
||||
#include "util/FFstrbuf.h"
|
||||
#include "util/FFlist.h"
|
||||
|
||||
#define UNUSED(...) (void)(__VA_ARGS__)
|
||||
static inline void ffUnused(int dummy, ...) { (void) dummy; }
|
||||
#define FF_UNUSED(...) ffUnused(0, __VA_ARGS__);
|
||||
|
||||
#define FASTFETCH_TEXT_MODIFIER_BOLT "\033[1m"
|
||||
#define FASTFETCH_TEXT_MODIFIER_ERROR "\033[1;31m"
|
||||
|
||||
+1
-2
@@ -3,8 +3,7 @@
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
//Disable compiler warnings
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
FF_UNUSED(argc, argv);
|
||||
|
||||
FFinstance instance;
|
||||
ffInitInstance(&instance); //This also applys default configuration to instance.config
|
||||
|
||||
+30
-36
@@ -59,24 +59,6 @@ static bool printResolutionResultList(FFinstance* instance, FFlist* results)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int parseRefreshRate(int32_t refreshRate)
|
||||
{
|
||||
if(refreshRate <= 0)
|
||||
return 0;
|
||||
|
||||
int remainder = refreshRate % 5;
|
||||
if(remainder >= 3)
|
||||
refreshRate += (5 - remainder);
|
||||
else
|
||||
refreshRate -= remainder;
|
||||
|
||||
//All other typicall refresh rates are dividable by 5
|
||||
if(refreshRate == 145)
|
||||
refreshRate = 144;
|
||||
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
static void printResolutionDRMBackend(FFinstance* instance)
|
||||
{
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
@@ -137,6 +119,28 @@ static void printResolutionDRMBackend(FFinstance* instance)
|
||||
printResolutionResultList(instance, &modes);
|
||||
}
|
||||
|
||||
#if defined(FF_HAVE_XRANDR) || defined(FF_HAVE_WAYLAND)
|
||||
|
||||
static int parseRefreshRate(int32_t refreshRate)
|
||||
{
|
||||
if(refreshRate <= 0)
|
||||
return 0;
|
||||
|
||||
int remainder = refreshRate % 5;
|
||||
if(remainder >= 3)
|
||||
refreshRate += (5 - remainder);
|
||||
else
|
||||
refreshRate -= remainder;
|
||||
|
||||
//All other typicall refresh rates are dividable by 5
|
||||
if(refreshRate == 145)
|
||||
refreshRate = 144;
|
||||
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
#endif //FF_HAVE_XRANDR || FF_HAVE_WAYLAND
|
||||
|
||||
#ifdef FF_HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
@@ -380,36 +384,26 @@ typedef struct WaylandData
|
||||
} WaylandData;
|
||||
|
||||
static void waylandGlobalRemoveListener(void* data, struct wl_registry* wl_registry, uint32_t name){
|
||||
UNUSED(data);
|
||||
UNUSED(wl_registry);
|
||||
UNUSED(name);
|
||||
FF_UNUSED(data, wl_registry, name);
|
||||
return;
|
||||
}
|
||||
|
||||
static void waylandOutputGeometryListener(void* data, struct wl_output* wl_output, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char* make, const char* model, int32_t transform)
|
||||
{
|
||||
UNUSED(data);
|
||||
UNUSED(wl_output);
|
||||
UNUSED(x);
|
||||
UNUSED(y);
|
||||
UNUSED(physical_width);
|
||||
UNUSED(physical_height);
|
||||
UNUSED(subpixel);
|
||||
UNUSED(make);
|
||||
UNUSED(model);
|
||||
UNUSED(transform);
|
||||
FF_UNUSED(data, wl_output, x, y, physical_width, physical_height, subpixel, make, model, transform);
|
||||
return;
|
||||
}
|
||||
|
||||
static void waylandOutputDoneListener(void* data, struct wl_output* wl_output)
|
||||
{
|
||||
UNUSED(data);
|
||||
UNUSED(wl_output);
|
||||
FF_UNUSED(data, wl_output);
|
||||
return;
|
||||
}
|
||||
|
||||
static void waylandOutputScaleListener(void* data, struct wl_output* wl_output, int32_t factor)
|
||||
{
|
||||
UNUSED(data);
|
||||
UNUSED(wl_output);
|
||||
UNUSED(factor);
|
||||
FF_UNUSED(data, wl_output, factor);
|
||||
return;
|
||||
}
|
||||
|
||||
static void waylandOutputModeListener(void* data, struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate)
|
||||
|
||||
+1
-2
@@ -16,8 +16,7 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
FF_UNUSED(argc, argv);
|
||||
|
||||
FFinstance instance;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user