[epiphany/mcatanzaro/file-launching: 4/4] flatpak-utils: Remember if we're under flatpak
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/file-launching: 4/4] flatpak-utils: Remember if we're under flatpak
- Date: Tue, 8 Jan 2019 04:05:32 +0000 (UTC)
commit d01a854c77aad254855e34aee5512efbbbf6f428
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Jan 7 21:35:38 2019 -0600
flatpak-utils: Remember if we're under flatpak
I added a bunch of asserts to ensure we're not running under flatpak
when we shouldn't be. Maybe it makes sense to only check the filesystem
once per thread, to avoid unnecessary I/O. A microoptimization, but an
easy and uncomplicated one.
lib/ephy-flatpak-utils.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
index 86fff8949..e9329ae5b 100644
--- a/lib/ephy-flatpak-utils.c
+++ b/lib/ephy-flatpak-utils.c
@@ -37,7 +37,15 @@
gboolean
ephy_is_running_inside_flatpak (void)
{
- return g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
+ static _Thread_local gboolean decided = FALSE;
+ static _Thread_local gboolean under_flatpak = FALSE;
+
+ if (decided)
+ return under_flatpak;
+
+ under_flatpak = g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
+ decided = TRUE;
+ return under_flatpak;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]