Final excision of libgsystem dependency

Lots and lots of preparation led to this moment - when nothing
apparent changes for users!  Woo!

But seriously, having the extra dependency is a minor annoyance, and
in the big picture I think the libgsystem idea was wrong - we need to
land things in GLib, and use git submodules for API-unstable or
Linux-specific sharing.  For a lot of OSTree, the libgsystem `GFile*`
orientation was also wrong, we really want fd-relative.

Closes: #444
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-08-09 15:36:09 +00:00
1 parent fd9536bb19
commit a29bb0ab6b
11 files changed
+50 -29

No files matched your search

-1
View File
@@ -21,7 +21,6 @@
#include "config.h"
#include "ot-fs-utils.h"
#include "libgsystem.h"
#include "libglnx.h"
#include <sys/xattr.h>
#include <gio/gunixinputstream.h>
+36
View File
@@ -463,3 +463,39 @@ ot_file_enumerator_iterate (GFileEnumerator *direnum,
}
#endif
G_LOCK_DEFINE_STATIC (pathname_cache);
/**
* ot_file_get_path_cached:
*
* Like g_file_get_path(), but returns a constant copy so callers
* don't need to free the result.
*/
const char *
ot_file_get_path_cached (GFile *file)
{
const char *path;
static GQuark _file_path_quark = 0;
if (G_UNLIKELY (_file_path_quark) == 0)
_file_path_quark = g_quark_from_static_string ("gsystem-file-path");
G_LOCK (pathname_cache);
path = g_object_get_qdata ((GObject*)file, _file_path_quark);
if (!path)
{
path = g_file_get_path (file);
if (path == NULL)
{
G_UNLOCK (pathname_cache);
return NULL;
}
g_object_set_qdata_full ((GObject*)file, _file_path_quark, (char*)path, (GDestroyNotify)g_free);
}
G_UNLOCK (pathname_cache);
return path;
}
+10
View File
@@ -115,4 +115,14 @@ ot_file_enumerator_iterate (GFileEnumerator *direnum,
#endif
#define g_file_enumerator_iterate ot_file_enumerator_iterate
const char *
ot_file_get_path_cached (GFile *file);
static inline
const char *
gs_file_get_path_cached (GFile *file)
{
return ot_file_get_path_cached (file);
}
G_END_DECLS
-2
View File
@@ -23,9 +23,7 @@
#pragma once
#include <gio/gio.h>
#include <libgsystem.h>
#include <string.h> /* Yeah...let's just do that here. */
#include <gsystem-local-alloc.h>
#include <libglnx.h>
#define ot_gobject_refz(o) (o ? g_object_ref (o) : o)
+1 -1
View File
@@ -23,8 +23,8 @@
#include "config.h"
#include "libglnx.h"
#include "otutil.h"
#include "ot-editor.h"
#include "libgsystem.h"
#include <sys/wait.h>
#include <string.h>