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. Closes: #222
This commit is contained in:
parent
bb08d2e3c2
commit
169ca1ba77
5 changed files with 37 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "fpi-compat.h"
|
||||||
#include "fpi-assembling.h"
|
#include "fpi-assembling.h"
|
||||||
#include "fpi-device.h"
|
#include "fpi-device.h"
|
||||||
#include "fpi-image-device.h"
|
#include "fpi-image-device.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define FP_COMPONENT "print"
|
#define FP_COMPONENT "print"
|
||||||
|
|
||||||
#include "fp-print-private.h"
|
#include "fp-print-private.h"
|
||||||
|
#include "fpi-compat.h"
|
||||||
#include "fpi-log.h"
|
#include "fpi-log.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
33
libfprint/fpi-compat.h
Normal file
33
libfprint/fpi-compat.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
/* Re-define G_SOURCE_FUNC as we are technically not allowed to use it with
|
||||||
|
* the version we depend on currently. */
|
||||||
|
#undef G_SOURCE_FUNC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define G_SOURCE_FUNC(f) ((GSourceFunc) (void (*)(void))(f))
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
#include "fp-context.h"
|
#include "fp-context.h"
|
||||||
|
#include "fpi-compat.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fpi_get_driver_types:
|
* fpi_get_driver_types:
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define FP_COMPONENT "device"
|
#define FP_COMPONENT "device"
|
||||||
|
|
||||||
#include "fpi-device.h"
|
#include "fpi-device.h"
|
||||||
|
#include "fpi-compat.h"
|
||||||
#include "fpi-log.h"
|
#include "fpi-log.h"
|
||||||
#include "test-device-fake.h"
|
#include "test-device-fake.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue