summaryrefslogtreecommitdiff
path: root/glnx-backports.h
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-07-27 15:51:41 +0100
committerSimon McVittie <smcv@collabora.com>2022-08-19 10:59:24 +0100
commitc52b73d4ae58ee2e3f1572c1b546d929ecdbd0c8 (patch)
tree5b02b30282e1737cbd573a18f297387d70e1c40e /glnx-backports.h
parent5a60c0bca5d91ba701ca4a2f9bcfae9eec65253b (diff)
downloadlibglnx-c52b73d4ae58ee2e3f1572c1b546d929ecdbd0c8.tar.gz
Backport most of the test convenience helpers from GLib's GTest
This includes a test (who tests the tests themselves?). Run as `${build}/tests/testing --tap` with semi-modern GLib, or `${build}/tests/testing --verbose` with GLib < 2.38, to check that the output is as reasonable as possible given the limitations of the GLib version in use. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'glnx-backports.h')
-rw-r--r--glnx-backports.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/glnx-backports.h b/glnx-backports.h
index b535e2d..71c3f5c 100644
--- a/glnx-backports.h
+++ b/glnx-backports.h
@@ -1,6 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2015 Colin Walters <walters@verbum.org>
+ * Copyright 2017 Emmanuele Bassi
* SPDX-License-Identifier: LGPL-2.0-or-later
*
* GLIB - Library of useful routines for C programming
@@ -84,4 +85,9 @@ gboolean glnx_set_object (GObject **object_ptr,
#define G_OPTION_ENTRY_NULL { NULL, 0, 0, 0, NULL, NULL, NULL }
#endif
+#ifndef G_APPROX_VALUE /* added in 2.58 */
+#define G_APPROX_VALUE(a, b, epsilon) \
+ (((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon))
+#endif
+
G_END_DECLS