[epiphany/wip/google-safe-browsing: 5/13] gsb-utils: Remove unused fields from EphyGSBHashPrefixLookup



commit 40da83b3c579b60c6e48fcab4736a7b40508b74a
Author: Gabriel Ivascu <gabrielivascu gnome org>
Date:   Fri Sep 22 20:26:12 2017 +0300

    gsb-utils: Remove unused fields from EphyGSBHashPrefixLookup

 lib/safe-browsing/ephy-gsb-storage.c |   15 +++------------
 lib/safe-browsing/ephy-gsb-utils.c   |   12 ------------
 lib/safe-browsing/ephy-gsb-utils.h   |    6 ------
 3 files changed, 3 insertions(+), 30 deletions(-)
---
diff --git a/lib/safe-browsing/ephy-gsb-storage.c b/lib/safe-browsing/ephy-gsb-storage.c
index a646cad..d7fd792 100644
--- a/lib/safe-browsing/ephy-gsb-storage.c
+++ b/lib/safe-browsing/ephy-gsb-storage.c
@@ -1231,8 +1231,7 @@ ephy_gsb_storage_lookup_hash_prefixes (EphyGSBStorage *self,
   g_assert (self->is_operable);
   g_assert (cues);
 
-  sql = g_string_new ("SELECT value, threat_type, platform_type, threat_entry_type, "
-                      "negative_expires_at <= (CAST(strftime('%s', 'now') AS INT)) "
+  sql = g_string_new ("SELECT value, negative_expires_at <= (CAST(strftime('%s', 'now') AS INT)) "
                       "FROM hash_prefix WHERE cue IN (");
   for (GList *l = cues; l && l->data; l = l->next)
     g_string_append (sql, "?,");
@@ -1263,16 +1262,8 @@ ephy_gsb_storage_lookup_hash_prefixes (EphyGSBStorage *self,
   while (ephy_sqlite_statement_step (statement, &error)) {
     const guint8 *blob = ephy_sqlite_statement_get_column_as_blob (statement, 0);
     gsize size = ephy_sqlite_statement_get_column_size (statement, 0);
-    const char *threat_type = ephy_sqlite_statement_get_column_as_string (statement, 1);
-    const char *platform_type = ephy_sqlite_statement_get_column_as_string (statement, 2);
-    const char *threat_entry_type = ephy_sqlite_statement_get_column_as_string (statement, 3);
-    gboolean negative_expired = ephy_sqlite_statement_get_column_as_boolean (statement, 4);
-    EphyGSBHashPrefixLookup *lookup = ephy_gsb_hash_prefix_lookup_new (blob, size,
-                                                                       threat_type,
-                                                                       platform_type,
-                                                                       threat_entry_type,
-                                                                       negative_expired);
-    retval = g_list_prepend (retval, lookup);
+    gboolean negative_expired = ephy_sqlite_statement_get_column_as_boolean (statement, 1);
+    retval = g_list_prepend (retval, ephy_gsb_hash_prefix_lookup_new (blob, size, negative_expired));
   }
 
   if (error) {
diff --git a/lib/safe-browsing/ephy-gsb-utils.c b/lib/safe-browsing/ephy-gsb-utils.c
index fa9cfab..5db5b30 100644
--- a/lib/safe-browsing/ephy-gsb-utils.c
+++ b/lib/safe-browsing/ephy-gsb-utils.c
@@ -201,23 +201,14 @@ ephy_gsb_threat_list_equal (EphyGSBThreatList *l1,
 EphyGSBHashPrefixLookup *
 ephy_gsb_hash_prefix_lookup_new (const guint8 *prefix,
                                  gsize         length,
-                                 const char   *threat_type,
-                                 const char   *platform_type,
-                                 const char   *threat_entry_type,
                                  gboolean      negative_expired)
 {
   EphyGSBHashPrefixLookup *lookup;
 
   g_assert (prefix);
-  g_assert (threat_type);
-  g_assert (platform_type);
-  g_assert (threat_entry_type);
 
   lookup = g_slice_new (EphyGSBHashPrefixLookup);
   lookup->prefix = g_bytes_new (prefix, length);
-  lookup->threat_type = g_strdup (threat_type);
-  lookup->platform_type = g_strdup (platform_type);
-  lookup->threat_entry_type = g_strdup (threat_entry_type);
   lookup->negative_expired = negative_expired;
 
   return lookup;
@@ -229,9 +220,6 @@ ephy_gsb_hash_prefix_lookup_free (EphyGSBHashPrefixLookup *lookup)
   g_assert (lookup);
 
   g_bytes_unref (lookup->prefix);
-  g_free (lookup->threat_type);
-  g_free (lookup->platform_type);
-  g_free (lookup->threat_entry_type);
   g_slice_free (EphyGSBHashPrefixLookup, lookup);
 }
 
diff --git a/lib/safe-browsing/ephy-gsb-utils.h b/lib/safe-browsing/ephy-gsb-utils.h
index 04a7af4..cfeb75d 100644
--- a/lib/safe-browsing/ephy-gsb-utils.h
+++ b/lib/safe-browsing/ephy-gsb-utils.h
@@ -48,9 +48,6 @@ typedef struct {
 
 typedef struct {
   GBytes   *prefix; /* The first 4-32 bytes of the hash */
-  char     *threat_type;
-  char     *platform_type;
-  char     *threat_entry_type;
   gboolean  negative_expired;
 } EphyGSBHashPrefixLookup;
 
@@ -72,9 +69,6 @@ gboolean                 ephy_gsb_threat_list_equal               (EphyGSBThreat
 
 EphyGSBHashPrefixLookup *ephy_gsb_hash_prefix_lookup_new          (const guint8 *prefix,
                                                                    gsize         length,
-                                                                   const char   *threat_type,
-                                                                   const char   *platform_type,
-                                                                   const char   *threat_entry_type,
                                                                    gboolean      negative_expired);
 void                     ephy_gsb_hash_prefix_lookup_free         (EphyGSBHashPrefixLookup *lookup);
 


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