[epiphany] history-service: Remove useless allocations



commit 1dd71f3e08c9497b748e1138ec11910f3d2a53ce
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Feb 21 09:54:11 2017 -0600

    history-service: Remove useless allocations

 lib/history/ephy-history-service-hosts-table.c |    7 +++----
 lib/history/ephy-history-service-urls-table.c  |    7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/lib/history/ephy-history-service-hosts-table.c b/lib/history/ephy-history-service-hosts-table.c
index 45d8d04..34b9de0 100644
--- a/lib/history/ephy-history-service-hosts-table.c
+++ b/lib/history/ephy-history-service-hosts-table.c
@@ -425,7 +425,7 @@ ephy_history_service_delete_host_row (EphyHistoryService *self,
                                       EphyHistoryHost    *host)
 {
   EphySQLiteStatement *statement = NULL;
-  gchar *sql_statement;
+  const char *sql_statement;
   GError *error = NULL;
 
   g_assert (self->history_thread == g_thread_self ());
@@ -434,13 +434,12 @@ ephy_history_service_delete_host_row (EphyHistoryService *self,
   g_assert (host->id != -1 || host->url);
 
   if (host->id != -1)
-    sql_statement = g_strdup ("DELETE FROM hosts WHERE id=?");
+    sql_statement = "DELETE FROM hosts WHERE id=?";
   else
-    sql_statement = g_strdup ("DELETE FROM hosts WHERE url=?");
+    sql_statement = "DELETE FROM hosts WHERE url=?";
 
   statement = ephy_sqlite_connection_create_statement (self->history_database,
                                                        sql_statement, &error);
-  g_free (sql_statement);
 
   if (error) {
     g_warning ("Could not build urls table query statement: %s", error->message);
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index 9afe5bd..8e6b1a7 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -389,7 +389,7 @@ void
 ephy_history_service_delete_url (EphyHistoryService *self, EphyHistoryURL *url)
 {
   EphySQLiteStatement *statement = NULL;
-  gchar *sql_statement;
+  const char *sql_statement;
   GError *error = NULL;
 
   g_assert (self->history_thread == g_thread_self ());
@@ -398,13 +398,12 @@ ephy_history_service_delete_url (EphyHistoryService *self, EphyHistoryURL *url)
   g_return_if_fail (url->id != -1 || url->url);
 
   if (url->id != -1)
-    sql_statement = g_strdup ("DELETE FROM urls WHERE id=?");
+    sql_statement = "DELETE FROM urls WHERE id=?";
   else
-    sql_statement = g_strdup ("DELETE FROM urls WHERE url=?");
+    sql_statement = "DELETE FROM urls WHERE url=?";
 
   statement = ephy_sqlite_connection_create_statement (self->history_database,
                                                        sql_statement, &error);
-  g_free (sql_statement);
 
   if (error) {
     g_warning ("Could not build urls table query statement: %s", error->message);


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