summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2023-05-15 14:42:15 +0100
committerSimon McVittie <smcv@collabora.com>2023-05-17 11:35:44 +0100
commitd9a3f34d441a743ff22e7c6e727df18a87846b77 (patch)
treea701d45a9af744361d4a8720a686dd7c112644c3
parentecab8828965c8664776a155b265e8fe6875e66ac (diff)
downloadflatpak-d9a3f34d441a743ff22e7c6e727df18a87846b77.tar.gz
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 <smcv@collabora.com>
-rw-r--r--common/Makefile.am.inc1
-rw-r--r--common/flatpak-instance.c1
-rw-r--r--common/flatpak-json-backports-private.h35
-rw-r--r--common/flatpak-utils-private.h12
4 files changed, 37 insertions, 12 deletions
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 <fcntl.h>
#include <unistd.h>
+#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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <json-glib/json-glib.h>
+
+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 <ostree.h>
-#include <json-glib/json-glib.h>
#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
*/