115 lines
3.4 KiB
Diff
115 lines
3.4 KiB
Diff
From 96a9d5efa0309af8b61a7f728e85efd40b003f54 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Berg <bberg@redhat.com>
|
|
Date: Mon, 13 Jan 2020 15:16:04 +0100
|
|
Subject: [PATCH 178/181] compat: Add compatibility defines for older GLib
|
|
|
|
We are already using a number of defines and autoptrs from newer GLib
|
|
releases. Add the appropriate compatibility defines rather than removing
|
|
the corresponding code.
|
|
|
|
Placing this into fpi-log.h is not ideal, but it seems to catch all
|
|
use-cases currently.
|
|
|
|
Closes: #222
|
|
---
|
|
libfprint/drivers_api.h | 1 +
|
|
libfprint/fpi-compat.h | 31 +++++++++++++++++++++++
|
|
libfprint/fpi-log.h | 3 +++
|
|
libfprint/fprint-list-supported-devices.c | 2 ++
|
|
libfprint/fprint-list-udev-rules.c | 2 ++
|
|
5 files changed, 39 insertions(+)
|
|
create mode 100644 libfprint/fpi-compat.h
|
|
|
|
diff --git a/libfprint/drivers_api.h b/libfprint/drivers_api.h
|
|
index 7476ba7..aef8c9d 100644
|
|
--- a/libfprint/drivers_api.h
|
|
+++ b/libfprint/drivers_api.h
|
|
@@ -21,6 +21,7 @@
|
|
|
|
#pragma once
|
|
|
|
+#include "fpi-compat.h"
|
|
#include "fpi-assembling.h"
|
|
#include "fpi-device.h"
|
|
#include "fpi-image-device.h"
|
|
diff --git a/libfprint/fpi-compat.h b/libfprint/fpi-compat.h
|
|
new file mode 100644
|
|
index 0000000..396fc77
|
|
--- /dev/null
|
|
+++ b/libfprint/fpi-compat.h
|
|
@@ -0,0 +1,31 @@
|
|
+/*
|
|
+ * Copyright (C) 2020 Benjamin Berg <bberg@redhat.com>
|
|
+ *
|
|
+ * This library 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, write to the Free Software
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
+ */
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include <glib-object.h>
|
|
+
|
|
+#if !GLIB_CHECK_VERSION (2, 57, 0)
|
|
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GTypeClass, g_type_class_unref);
|
|
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GEnumClass, g_type_class_unref);
|
|
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GParamSpec, g_param_spec_unref);
|
|
+#else
|
|
+#undef G_SOURCE_FUNC
|
|
+#endif
|
|
+
|
|
+#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void)) (f))
|
|
diff --git a/libfprint/fpi-log.h b/libfprint/fpi-log.h
|
|
index da61204..53546c2 100644
|
|
--- a/libfprint/fpi-log.h
|
|
+++ b/libfprint/fpi-log.h
|
|
@@ -19,6 +19,9 @@
|
|
|
|
#pragma once
|
|
|
|
+/* To avoid having to add it everywhere, at least for now. */
|
|
+#include "fpi-compat.h"
|
|
+
|
|
/**
|
|
* SECTION:fpi-log
|
|
* @title: Logging
|
|
diff --git a/libfprint/fprint-list-supported-devices.c b/libfprint/fprint-list-supported-devices.c
|
|
index cb2803f..1231ed0 100644
|
|
--- a/libfprint/fprint-list-supported-devices.c
|
|
+++ b/libfprint/fprint-list-supported-devices.c
|
|
@@ -26,6 +26,8 @@
|
|
#include "fpi-context.h"
|
|
#include "fpi-device.h"
|
|
|
|
+#include "fpi-compat.h"
|
|
+
|
|
GHashTable *printed = NULL;
|
|
|
|
static GList *
|
|
diff --git a/libfprint/fprint-list-udev-rules.c b/libfprint/fprint-list-udev-rules.c
|
|
index ac50797..3bc64e8 100644
|
|
--- a/libfprint/fprint-list-udev-rules.c
|
|
+++ b/libfprint/fprint-list-udev-rules.c
|
|
@@ -21,6 +21,8 @@
|
|
|
|
#include <config.h>
|
|
|
|
+#include "fpi-compat.h"
|
|
+
|
|
#include "fpi-context.h"
|
|
#include "fpi-device.h"
|
|
|
|
--
|
|
2.24.1
|
|
|