[tracker-miners/wip/carlosg/miner-files-queues: 8/10] libtracker-miner: Change function arguments
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/miner-files-queues: 8/10] libtracker-miner: Change function arguments
- Date: Thu, 30 Dec 2021 10:59:58 +0000 (UTC)
commit b74127dc08bd652e0d6364144397c1f8c0c76738
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Dec 18 18:47:06 2021 +0100
libtracker-miner: Change function arguments
We no longer need those many details for
tracker_miner_fs_get_identifier(), so remove these, and make it
return a const string.
src/libtracker-miner/tracker-miner-fs.c | 22 +++-------------------
src/libtracker-miner/tracker-miner-fs.h | 7 ++-----
src/miners/fs/tracker-miner-files-methods.c | 17 +++++++----------
src/miners/fs/tracker-miner-files.c | 13 ++++---------
4 files changed, 16 insertions(+), 43 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 024af7348..f7b2023ce 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2052,25 +2052,9 @@ tracker_miner_fs_get_data_provider (TrackerMinerFS *fs)
return fs->priv->data_provider;
}
-gchar *
+const gchar *
tracker_miner_fs_get_identifier (TrackerMinerFS *miner,
- GFile *file,
- gboolean new_resource,
- gboolean check_batch,
- gboolean *is_iri)
+ GFile *file)
{
- const gchar *urn = NULL;
-
- if (is_iri)
- *is_iri = FALSE;
-
- urn = tracker_miner_fs_get_folder_urn (miner, file);
-
- if (urn) {
- if (is_iri)
- *is_iri = TRUE;
- return g_strdup (urn);
- }
-
- return NULL;
+ return tracker_miner_fs_get_folder_urn (miner, file);
}
diff --git a/src/libtracker-miner/tracker-miner-fs.h b/src/libtracker-miner/tracker-miner-fs.h
index d76adaf1b..021646d5e 100644
--- a/src/libtracker-miner/tracker-miner-fs.h
+++ b/src/libtracker-miner/tracker-miner-fs.h
@@ -165,11 +165,8 @@ void tracker_miner_fs_notify_finish (TrackerMinerFS *f
GError *error);
/* URNs */
-gchar * tracker_miner_fs_get_identifier (TrackerMinerFS *miner,
- GFile *file,
- gboolean new_resource,
- gboolean check_batch,
- gboolean *is_iri);
+const gchar * tracker_miner_fs_get_identifier (TrackerMinerFS *miner,
+ GFile *file);
/* Progress */
gboolean tracker_miner_fs_has_items_to_process (TrackerMinerFS *fs);
diff --git a/src/miners/fs/tracker-miner-files-methods.c b/src/miners/fs/tracker-miner-files-methods.c
index cb5ada7ee..e94610ad8 100644
--- a/src/miners/fs/tracker-miner-files-methods.c
+++ b/src/miners/fs/tracker-miner-files-methods.c
@@ -41,18 +41,16 @@ miner_files_add_to_datasource (TrackerMinerFiles *mf,
if (tracker_indexing_tree_file_is_root (indexing_tree, file)) {
tracker_resource_set_relation (resource, "nie:dataSource", element_resource);
} else {
- gchar *identifier = NULL;
+ const gchar *identifier = NULL;
GFile *root;
root = tracker_indexing_tree_get_root (indexing_tree, file, NULL);
if (root)
- identifier = tracker_miner_fs_get_identifier (fs, root, FALSE, TRUE, NULL);
+ identifier = tracker_miner_fs_get_identifier (fs, root);
if (identifier)
tracker_resource_set_uri (resource, "nie:dataSource", identifier);
-
- g_free (identifier);
}
}
@@ -86,13 +84,13 @@ miner_files_create_folder_information_element (TrackerMinerFiles *miner,
{
TrackerResource *resource, *file_resource;
TrackerIndexingTree *indexing_tree;
- gchar *urn, *uri;
+ const gchar *urn;
+ gchar *uri;
/* Preserve URN for nfo:Folders */
urn = tracker_miner_fs_get_identifier (TRACKER_MINER_FS (miner),
- file, create, TRUE, NULL);
+ file);
resource = tracker_resource_new (urn);
- g_free (urn);
tracker_resource_set_string (resource, "nie:mimeType", mime_type);
tracker_resource_add_uri (resource, "rdf:type", "nie:InformationElement");
@@ -132,7 +130,7 @@ tracker_miner_files_process_file (TrackerMinerFS *fs,
TrackerIndexingTree *indexing_tree;
TrackerResource *resource = NULL, *folder_resource = NULL, *graph_file = NULL;
const gchar *mime_type, *graph;
- gchar *parent_urn;
+ const gchar *parent_urn;
gchar *delete_properties_sparql = NULL;
GFile *parent;
gchar *uri;
@@ -184,12 +182,11 @@ tracker_miner_files_process_file (TrackerMinerFS *fs,
tracker_resource_add_uri (resource, "rdf:type", "nfo:FileDataObject");
parent = g_file_get_parent (file);
- parent_urn = tracker_miner_fs_get_identifier (fs, parent, FALSE, TRUE, NULL);
+ parent_urn = tracker_miner_fs_get_identifier (fs, parent);
g_object_unref (parent);
if (parent_urn) {
tracker_resource_set_uri (resource, "nfo:belongsToContainer", parent_urn);
- g_free (parent_urn);
}
tracker_resource_set_string (resource, "nfo:fileName",
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 7c5cc27ea..5b3cfd62d 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2130,20 +2130,15 @@ miner_files_move_file (TrackerMinerFS *fs,
/* Get new parent information */
new_parent = g_file_get_parent (file);
if (new_parent) {
- gchar *new_parent_id;
- gboolean is_iri;
+ const gchar *new_parent_id;
- new_parent_id = tracker_miner_fs_get_identifier (fs, new_parent, FALSE, FALSE, &is_iri);
+ new_parent_id = tracker_miner_fs_get_identifier (fs, new_parent);
if (new_parent_id) {
container_clause =
- g_strdup_printf ("; nfo:belongsToContainer %s%s%s",
- is_iri ? "<" : "",
- new_parent_id,
- is_iri ? ">" : "");
+ g_strdup_printf ("; nfo:belongsToContainer <%s>",
+ new_parent_id);
}
-
- g_free (new_parent_id);
}
/* Update nie:isStoredAs in the nie:InformationElement */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]