diff --git a/src/common/unused.h b/src/common/unused.h index 98e21a2e6..9eb9f7dca 100644 --- a/src/common/unused.h +++ b/src/common/unused.h @@ -1,6 +1,4 @@ #pragma once -static inline void ffUnused(int dummy, ...) { - (void) dummy; -} -#define FF_UNUSED(...) ffUnused(0, __VA_ARGS__); +static inline void ffUnused(...) { /* no-op */ } +#define FF_UNUSED(...) ffUnused(__VA_ARGS__); diff --git a/src/detection/displayserver/linux/wayland/global-output.c b/src/detection/displayserver/linux/wayland/global-output.c index 26553a2dd..6639a70c2 100644 --- a/src/detection/displayserver/linux/wayland/global-output.c +++ b/src/detection/displayserver/linux/wayland/global-output.c @@ -64,9 +64,9 @@ static struct wl_output_listener outputListener = { }; static struct zxdg_output_v1_listener zxdgOutputListener = { - .logical_position = (void*) ffWaylandStubListener, + .logical_position = (void*) ffUnused, .logical_size = handleXdgLogicalSize, - .done = (void*) ffWaylandStubListener, + .done = (void*) ffUnused, .name = (void*) ffWaylandOutputNameListener, .description = (void*) ffWaylandOutputDescriptionListener, }; @@ -84,17 +84,17 @@ static void handleWpTfNamed(void *data, [[maybe_unused]] struct wp_image_descrip } static const struct wp_image_description_info_v1_listener wpImageDescInfoListener = { - .done = (void*) ffWaylandStubListener, - .icc_file = (void*) ffWaylandStubListener, - .primaries = (void*) ffWaylandStubListener, - .primaries_named = (void*) ffWaylandStubListener, - .tf_power = (void*) ffWaylandStubListener, + .done = (void*) ffUnused, + .icc_file = (void*) ffUnused, + .primaries = (void*) ffUnused, + .primaries_named = (void*) ffUnused, + .tf_power = (void*) ffUnused, .tf_named = (void*) handleWpTfNamed, - .luminances = (void*) ffWaylandStubListener, - .target_primaries = (void*) ffWaylandStubListener, - .target_luminance = (void*) ffWaylandStubListener, - .target_max_cll = (void*) ffWaylandStubListener, - .target_max_fall = (void*) ffWaylandStubListener, + .luminances = (void*) ffUnused, + .target_primaries = (void*) ffUnused, + .target_luminance = (void*) ffUnused, + .target_max_cll = (void*) ffUnused, + .target_max_fall = (void*) ffUnused, }; const char* ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) { diff --git a/src/detection/displayserver/linux/wayland/kde-output.c b/src/detection/displayserver/linux/wayland/kde-output.c index 602827d30..ab8829cf4 100644 --- a/src/detection/displayserver/linux/wayland/kde-output.c +++ b/src/detection/displayserver/linux/wayland/kde-output.c @@ -33,8 +33,8 @@ static const struct kde_output_device_mode_v2_listener modeListener = { .size = waylandKdeModeSizeListener, .refresh = waylandKdeModeRefreshListener, .preferred = waylandKdeModePreferredListener, - .removed = (void*) ffWaylandStubListener, - .flags = (void*) ffWaylandStubListener, + .removed = (void*) ffUnused, + .flags = (void*) ffUnused, }; static void waylandKdeModeListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) { @@ -160,39 +160,39 @@ static struct kde_output_device_v2_listener outputListener = { .scale = waylandKdeScaleListener, .edid = waylandKdeEdidListener, .enabled = waylandKdeEnabledListener, - .uuid = (void*) ffWaylandStubListener, - .serial_number = (void*) ffWaylandStubListener, - .eisa_id = (void*) ffWaylandStubListener, - .capabilities = (void*) ffWaylandStubListener, - .overscan = (void*) ffWaylandStubListener, - .vrr_policy = (void*) ffWaylandStubListener, - .rgb_range = (void*) ffWaylandStubListener, + .uuid = (void*) ffUnused, + .serial_number = (void*) ffUnused, + .eisa_id = (void*) ffUnused, + .capabilities = (void*) ffUnused, + .overscan = (void*) ffUnused, + .vrr_policy = (void*) ffUnused, + .rgb_range = (void*) ffUnused, .name = waylandKdeNameListener, .high_dynamic_range = waylandKdeHdrListener, - .sdr_brightness = (void*) ffWaylandStubListener, - .wide_color_gamut = (void*) ffWaylandStubListener, - .auto_rotate_policy = (void*) ffWaylandStubListener, - .icc_profile_path = (void*) ffWaylandStubListener, - .brightness_metadata = (void*) ffWaylandStubListener, - .brightness_overrides = (void*) ffWaylandStubListener, - .sdr_gamut_wideness = (void*) ffWaylandStubListener, - .color_profile_source = (void*) ffWaylandStubListener, - .brightness = (void*) ffWaylandStubListener, - .color_power_tradeoff = (void*) ffWaylandStubListener, - .dimming = (void*) ffWaylandStubListener, - .replication_source = (void*) ffWaylandStubListener, - .ddc_ci_allowed = (void*) ffWaylandStubListener, + .sdr_brightness = (void*) ffUnused, + .wide_color_gamut = (void*) ffUnused, + .auto_rotate_policy = (void*) ffUnused, + .icc_profile_path = (void*) ffUnused, + .brightness_metadata = (void*) ffUnused, + .brightness_overrides = (void*) ffUnused, + .sdr_gamut_wideness = (void*) ffUnused, + .color_profile_source = (void*) ffUnused, + .brightness = (void*) ffUnused, + .color_power_tradeoff = (void*) ffUnused, + .dimming = (void*) ffUnused, + .replication_source = (void*) ffUnused, + .ddc_ci_allowed = (void*) ffUnused, .max_bits_per_color = (void*) waylandKdeMaxBitsPerColorListener, - .max_bits_per_color_range = (void*) ffWaylandStubListener, - .automatic_max_bits_per_color_limit = (void*) ffWaylandStubListener, - .edr_policy = (void*) ffWaylandStubListener, - .sharpness = (void*) ffWaylandStubListener, + .max_bits_per_color_range = (void*) ffUnused, + .automatic_max_bits_per_color_limit = (void*) ffUnused, + .edr_policy = (void*) ffUnused, + .sharpness = (void*) ffUnused, .priority = waylandKdePriorityListener, - .auto_brightness = (void*) ffWaylandStubListener, - .removed = (void*) ffWaylandStubListener, - .hdr_icc_profile_path = (void*) ffWaylandStubListener, - .hdr_color_profile_source = (void*) ffWaylandStubListener, - .abm_level = (void*) ffWaylandStubListener, + .auto_brightness = (void*) ffUnused, + .removed = (void*) ffUnused, + .hdr_icc_profile_path = (void*) ffUnused, + .hdr_color_profile_source = (void*) ffUnused, + .abm_level = (void*) ffUnused, }; static const char* waylandKdeHandleOutput(WaylandData* wldata, struct wl_proxy* output) { @@ -300,7 +300,7 @@ static void waylandKdeOutputListener(void* data, [[maybe_unused]] struct kde_out static struct kde_output_device_registry_v2_listener registryListener = { .output = waylandKdeOutputListener, - .finished = (void*) ffWaylandStubListener, + .finished = (void*) ffUnused, }; const char* ffWaylandHandleKdeOutputRegistry(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) { diff --git a/src/detection/displayserver/linux/wayland/wayland.c b/src/detection/displayserver/linux/wayland/wayland.c index c1beb6911..29c1d46e9 100644 --- a/src/detection/displayserver/linux/wayland/wayland.c +++ b/src/detection/displayserver/linux/wayland/wayland.c @@ -292,7 +292,7 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) { struct wl_registry_listener registry_listener = { .global = waylandGlobalAddListener, - .global_remove = (void*) ffWaylandStubListener + .global_remove = (void*) ffUnused }; data.ffwl_proxy_add_listener(registry, (void (**)(void)) ®istry_listener, &data); @@ -378,10 +378,6 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) { return nullptr; } -void ffWaylandStubListener(...) { - // no-op -} - #else const char* ffdsConnectWayland([[maybe_unused]] FFDisplayServerResult* result) { diff --git a/src/detection/displayserver/linux/wayland/wayland.h b/src/detection/displayserver/linux/wayland/wayland.h index b7d486cce..e225eb881 100644 --- a/src/detection/displayserver/linux/wayland/wayland.h +++ b/src/detection/displayserver/linux/wayland/wayland.h @@ -68,8 +68,6 @@ typedef struct WaylandDisplay { bool done; } WaylandDisplay; -void ffWaylandStubListener(...); - inline static uint64_t ffWaylandGenerateIdFromName(const char* name) { uint64_t id = 0; size_t len = strlen(name);