From d9a3f34d441a743ff22e7c6e727df18a87846b77 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 May 2023 14:42:15 +0100 Subject: common: Move json-glib backports to their own file There is currently no source for this one, only a header. Signed-off-by: Simon McVittie --- common/Makefile.am.inc | 1 + common/flatpak-instance.c | 1 + common/flatpak-json-backports-private.h | 35 +++++++++++++++++++++++++++++++++ common/flatpak-utils-private.h | 12 ----------- 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 common/flatpak-json-backports-private.h (limited to 'common') diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc index 5fa127ab..d77202fb 100644 --- a/common/Makefile.am.inc +++ b/common/Makefile.am.inc @@ -142,6 +142,7 @@ libflatpak_common_la_SOURCES = \ common/flatpak-installed-ref.c \ common/flatpak-instance-private.h \ common/flatpak-instance.c \ + common/flatpak-json-backports-private.h \ common/flatpak-json-oci-private.h \ common/flatpak-json-oci.c \ common/flatpak-json-private.h \ diff --git a/common/flatpak-instance.c b/common/flatpak-instance.c index 3623043d..b29e886e 100644 --- a/common/flatpak-instance.c +++ b/common/flatpak-instance.c @@ -23,6 +23,7 @@ #include #include +#include "flatpak-json-backports-private.h" #include "flatpak-utils-base-private.h" #include "flatpak-utils-private.h" #include "flatpak-run-private.h" diff --git a/common/flatpak-json-backports-private.h b/common/flatpak-json-backports-private.h new file mode 100644 index 00000000..f2df741a --- /dev/null +++ b/common/flatpak-json-backports-private.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2014-2016 Red Hat, Inc + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#if !JSON_CHECK_VERSION (1, 1, 2) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonArray, json_array_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonBuilder, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonGenerator, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonObject, json_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonPath, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonReader, g_object_unref) +#endif + +G_END_DECLS diff --git a/common/flatpak-utils-private.h b/common/flatpak-utils-private.h index 1ba0f9d8..83e4e55e 100644 --- a/common/flatpak-utils-private.h +++ b/common/flatpak-utils-private.h @@ -36,7 +36,6 @@ #include "flatpak-variant-private.h" #include "flatpak-dir-private.h" #include -#include #define AUTOFS_SUPER_MAGIC 0x0187 @@ -617,17 +616,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRepoTransaction, flatpak_repo_transaction_ #define AUTOLOCK(name) G_GNUC_UNUSED __attribute__((cleanup (flatpak_auto_unlock_helper))) GMutex * G_PASTE (auto_unlock, __LINE__) = flatpak_auto_lock_helper (&G_LOCK_NAME (name)) -#if !JSON_CHECK_VERSION (1, 1, 2) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonArray, json_array_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonBuilder, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonGenerator, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonObject, json_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonPath, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonReader, g_object_unref) -#endif - /* This uses a weird Auto prefix to avoid conflicts with later added autogenerated autoptr support, per: * https://git.gnome.org/browse/glib/commit/?id=1c6cd5f0a3104aa9b62c7f1d3086181f63e71b59 */ -- cgit v1.2.1