[tracker/wip/carlosg/sparql1.1: 23/56] libtracker-data: Cleanup unneeded argument



commit 387bfbd90db8da47108d145af45bd6cea1e151e0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon May 20 01:48:52 2019 +0200

    libtracker-data: Cleanup unneeded argument
    
    This variable is unused, besides storage and comparison.

 src/libtracker-data/tracker-sparql-types.c | 10 ++--------
 src/libtracker-data/tracker-sparql-types.h |  3 ---
 src/libtracker-data/tracker-sparql.c       |  6 +-----
 3 files changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-types.c b/src/libtracker-data/tracker-sparql-types.c
index 38765cb44..c5f01b9f0 100644
--- a/src/libtracker-data/tracker-sparql-types.c
+++ b/src/libtracker-data/tracker-sparql-types.c
@@ -33,13 +33,11 @@ enum {
 /* Helper structs */
 static TrackerDataTable *
 tracker_data_table_new (const gchar *tablename,
-                       const gchar *subject,
                         gint         idx)
 {
        TrackerDataTable *table;
 
        table = g_new0 (TrackerDataTable, 1);
-       table->subject = g_strdup (subject);
        table->sql_db_tablename = g_strdup (tablename);
        table->sql_query_tablename = g_strdup_printf ("%s%d", tablename, idx);
 
@@ -49,7 +47,6 @@ tracker_data_table_new (const gchar *tablename,
 static void
 tracker_data_table_free (TrackerDataTable *table)
 {
-       g_free (table->subject);
        g_free (table->sql_db_tablename);
        g_free (table->sql_query_tablename);
        g_free (table);
@@ -877,7 +874,6 @@ tracker_triple_context_new (void)
 
 TrackerDataTable *
 tracker_triple_context_lookup_table (TrackerTripleContext *context,
-                                     const gchar          *subject,
                                      const gchar          *tablename)
 {
        TrackerDataTable *table = NULL;
@@ -888,8 +884,7 @@ tracker_triple_context_lookup_table (TrackerTripleContext *context,
 
                table = g_ptr_array_index (context->sql_tables, i);
 
-               if (g_strcmp0 (table->subject, subject) == 0 &&
-                   g_strcmp0 (table->sql_db_tablename, tablename) == 0)
+               if (g_strcmp0 (table->sql_db_tablename, tablename) == 0)
                        return table;
        }
 
@@ -898,12 +893,11 @@ tracker_triple_context_lookup_table (TrackerTripleContext *context,
 
 TrackerDataTable *
 tracker_triple_context_add_table (TrackerTripleContext *context,
-                                  const gchar          *subject,
                                   const gchar          *tablename)
 {
        TrackerDataTable *table;
 
-       table = tracker_data_table_new (tablename, subject, ++context->table_counter);
+       table = tracker_data_table_new (tablename, ++context->table_counter);
        g_ptr_array_add (context->sql_tables, table);
 
        return table;
diff --git a/src/libtracker-data/tracker-sparql-types.h b/src/libtracker-data/tracker-sparql-types.h
index a474f5142..24f373a8b 100644
--- a/src/libtracker-data/tracker-sparql-types.h
+++ b/src/libtracker-data/tracker-sparql-types.h
@@ -73,7 +73,6 @@ typedef struct _TrackerSolution TrackerSolution;
 typedef struct _TrackerPathElement TrackerPathElement;
 
 struct _TrackerDataTable {
-       gchar *subject; /* Subject this table is pulled from */
        gchar *sql_db_tablename; /* as in db schema */
        gchar *sql_query_tablename; /* temp. name, generated */
        gboolean predicate_variable;
@@ -359,10 +358,8 @@ GType            tracker_triple_context_get_type (void) G_GNUC_CONST;
 TrackerContext * tracker_triple_context_new (void);
 
 TrackerDataTable * tracker_triple_context_lookup_table (TrackerTripleContext *context,
-                                                        const gchar          *subject,
                                                         const gchar          *table);
 TrackerDataTable * tracker_triple_context_add_table    (TrackerTripleContext *context,
-                                                        const gchar          *subject,
                                                         const gchar          *table);
 void tracker_triple_context_add_literal_binding  (TrackerTripleContext   *context,
                                                  TrackerLiteralBinding  *binding);
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 2db7f18f2..d457a7603 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -1096,21 +1096,18 @@ _add_quad (TrackerSparql  *sparql,
 
                if (share_table) {
                        table = tracker_triple_context_lookup_table (triple_context,
-                                                                    tracker_token_get_idstring (subject),
                                                                     db_table);
                }
 
                if (!table) {
                        table = tracker_triple_context_add_table (triple_context,
-                                                                 tracker_token_get_idstring (subject),
                                                                  db_table);
                        new_table = TRUE;
                }
        } else if (tracker_token_get_variable (predicate)) {
                /* Variable in predicate */
                variable = tracker_token_get_variable (predicate);
-               table = tracker_triple_context_add_table (triple_context,
-                                                         variable->name, variable->name);
+               table = tracker_triple_context_add_table (triple_context, variable->name);
                tracker_data_table_set_predicate_variable (table, TRUE);
                new_table = TRUE;
 
@@ -1122,7 +1119,6 @@ _add_quad (TrackerSparql  *sparql,
                g_object_unref (binding);
        } else if (tracker_token_get_path (predicate)) {
                table = tracker_triple_context_add_table (triple_context,
-                                                         "value",
                                                          tracker_token_get_idstring (predicate));
                new_table = TRUE;
        } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]