From dbf764076448be44d7a3614fb7de94f7655c9d84 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 17 May 2025 19:55:04 +0200 Subject: [PATCH] makeHardcodeGsettingsPatch: Fix `schemaExistsFunction` w/o stdbool.h If project uses C and does not include `stdbool.h`, it will not have available lowercase booleans. However, since this tool targets GLib programs, we can rely on uppercase constants defined by GLib. (cherry picked from commit 5309164a9632bbe971a3b8915f6e0164962d9be0) --- .../make-hardcode-gsettings-patch/hardcode-gsettings.cocci | 2 +- .../fixtures/example-project-patched-with-exists-fn/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/make-hardcode-gsettings-patch/hardcode-gsettings.cocci b/pkgs/build-support/make-hardcode-gsettings-patch/hardcode-gsettings.cocci index ceee9a657610..a7374a117262 100644 --- a/pkgs/build-support/make-hardcode-gsettings-patch/hardcode-gsettings.cocci +++ b/pkgs/build-support/make-hardcode-gsettings-patch/hardcode-gsettings.cocci @@ -162,4 +162,4 @@ expression SCHEMA_ID; identifier schema_exists_fn.fn; @@ -fn(SCHEMA_ID) -+true ++TRUE diff --git a/pkgs/test/make-hardcode-gsettings-patch/fixtures/example-project-patched-with-exists-fn/main.c b/pkgs/test/make-hardcode-gsettings-patch/fixtures/example-project-patched-with-exists-fn/main.c index f99324cd9c64..3ad87f34b42a 100644 --- a/pkgs/test/make-hardcode-gsettings-patch/fixtures/example-project-patched-with-exists-fn/main.c +++ b/pkgs/test/make-hardcode-gsettings-patch/fixtures/example-project-patched-with-exists-fn/main.c @@ -74,7 +74,7 @@ void schema_id_with_path() { } void exists_fn_guard() { - if (!true) { + if (!TRUE) { return; } @@ -89,7 +89,7 @@ void exists_fn_guard() { } void exists_fn_nested() { - if (true) { + if (TRUE) { g_autoptr(GSettings) settings = NULL; { g_autoptr(GSettingsSchemaSource) schema_source; @@ -102,7 +102,7 @@ void exists_fn_nested() { } void exists_fn_unknown() { - if (true) { + if (TRUE) { g_autoptr(GSettings) settings = NULL; { g_autoptr(GSettingsSchemaSource) schema_source;