[libshumate] Use g_debug() instead of custom debug macro
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] Use g_debug() instead of custom debug macro
- Date: Wed, 19 May 2021 05:21:49 +0000 (UTC)
commit de26fecbc7f48b12dc0cb7873208b1f49fec002a
Author: James Westman <james jwestman net>
Date: Tue May 18 17:52:05 2021 -0500
Use g_debug() instead of custom debug macro
docs/reference/meson.build | 1 -
shumate/meson.build | 2 -
shumate/shumate-debug.c | 112 ----------------------------------
shumate/shumate-debug.h | 89 ---------------------------
shumate/shumate-file-cache.c | 45 +++++++-------
shumate/shumate-map-source-factory.c | 3 -
shumate/shumate-memory-cache.c | 3 -
shumate/shumate-network-tile-source.c | 11 ++--
shumate/shumate-view.c | 5 --
9 files changed, 25 insertions(+), 246 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index b7cdbcf..8c28ffa 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -8,7 +8,6 @@ gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
gtk_docpath = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html', 'gtk4')
libshumate_reference_ignored_h = [
- 'shumate-debug.h',
'shumate-enum-types.h',
'shumate-marshal.h',
'shumate.h',
diff --git a/shumate/meson.build b/shumate/meson.build
index 59dbe7b..61cd055 100644
--- a/shumate/meson.build
+++ b/shumate/meson.build
@@ -23,14 +23,12 @@ libshumate_public_h = [
]
libshumate_private_h = [
- 'shumate-debug.h',
'shumate-kinetic-scrolling-private.h',
'shumate-marker-private.h',
]
libshumate_sources = [
'shumate-coordinate.c',
- 'shumate-debug.c',
'shumate-file-cache.c',
'shumate-kinetic-scrolling.c',
'shumate-layer.c',
diff --git a/shumate/shumate-file-cache.c b/shumate/shumate-file-cache.c
index d061901..cd2a7f7 100644
--- a/shumate/shumate-file-cache.c
+++ b/shumate/shumate-file-cache.c
@@ -37,9 +37,6 @@
* using the HTTP If-None-Match header).
*/
-#define DEBUG_FLAG SHUMATE_DEBUG_CACHE
-#include "shumate-debug.h"
-
#include "shumate-file-cache.h"
#include <sqlite3.h>
@@ -156,7 +153,7 @@ finalize_sql (ShumateFileCache *file_cache)
{
int error = sqlite3_close (priv->db);
if (error != SQLITE_OK)
- DEBUG ("Sqlite returned error %d when closing cache.db", error);
+ g_debug ("Sqlite returned error %d when closing cache.db", error);
priv->db = NULL;
}
}
@@ -212,7 +209,7 @@ init_cache (ShumateFileCache *file_cache)
if (error == SQLITE_ERROR)
{
- DEBUG ("Sqlite returned error %d when opening cache.db", error);
+ g_debug ("Sqlite returned error %d when opening cache.db", error);
return;
}
@@ -222,7 +219,7 @@ init_cache (ShumateFileCache *file_cache)
NULL, NULL, &error_msg);
if (error_msg != NULL)
{
- DEBUG ("Set PRAGMA: %s", error_msg);
+ g_debug ("Set PRAGMA: %s", error_msg);
sqlite3_free (error_msg);
return;
}
@@ -236,7 +233,7 @@ init_cache (ShumateFileCache *file_cache)
NULL, NULL, &error_msg);
if (error_msg != NULL)
{
- DEBUG ("Creating table 'tiles' failed: %s", error_msg);
+ g_debug ("Creating table 'tiles' failed: %s", error_msg);
sqlite3_free (error_msg);
return;
}
@@ -247,7 +244,7 @@ init_cache (ShumateFileCache *file_cache)
if (error != SQLITE_OK)
{
priv->stmt_select = NULL;
- DEBUG ("Failed to prepare the select Etag statement, error:%d: %s",
+ g_debug ("Failed to prepare the select Etag statement, error:%d: %s",
error, sqlite3_errmsg (priv->db));
return;
}
@@ -258,7 +255,7 @@ init_cache (ShumateFileCache *file_cache)
if (error != SQLITE_OK)
{
priv->stmt_update = NULL;
- DEBUG ("Failed to prepare the update popularity statement, error: %s",
+ g_debug ("Failed to prepare the update popularity statement, error: %s",
sqlite3_errmsg (priv->db));
return;
}
@@ -498,7 +495,7 @@ db_get_etag (ShumateFileCache *self, ShumateTile *tile)
sql_rc = sqlite3_bind_text (priv->stmt_select, 1, filename, -1, SQLITE_STATIC);
if (sql_rc == SQLITE_ERROR)
{
- DEBUG ("Failed to prepare the SQL query for finding the Etag of '%s', error: %s",
+ g_debug ("Failed to prepare the SQL query for finding the Etag of '%s', error: %s",
filename, sqlite3_errmsg (priv->db));
return NULL;
}
@@ -511,12 +508,12 @@ db_get_etag (ShumateFileCache *self, ShumateTile *tile)
}
else if (sql_rc == SQLITE_DONE)
{
- DEBUG ("'%s' doesn't have an etag",
+ g_debug ("'%s' doesn't have an etag",
filename);
}
else if (sql_rc == SQLITE_ERROR)
{
- DEBUG ("Failed to finding the Etag of '%s', %d error: %s",
+ g_debug ("Failed to finding the Etag of '%s', %d error: %s",
filename, sql_rc, sqlite3_errmsg (priv->db));
}
@@ -571,13 +568,13 @@ on_tile_filled (ShumateFileCache *self,
filename = get_filename (self, tile);
- DEBUG ("popularity of %s", filename);
+ g_debug ("popularity of %s", filename);
sqlite3_reset (priv->stmt_update);
sql_rc = sqlite3_bind_text (priv->stmt_update, 1, filename, -1, SQLITE_STATIC);
if (sql_rc != SQLITE_OK)
{
- DEBUG ("Failed to set values to the popularity query of '%s', error: %s",
+ g_debug ("Failed to set values to the popularity query of '%s', error: %s",
filename, sqlite3_errmsg (priv->db));
return;
}
@@ -605,7 +602,7 @@ delete_tile (ShumateFileCache *file_cache, const char *filename)
sqlite3_exec (priv->db, query, NULL, NULL, &error);
if (error != NULL)
{
- DEBUG ("Deleting tile from db failed: %s", error);
+ g_debug ("Deleting tile from db failed: %s", error);
sqlite3_free (error);
}
sqlite3_free (query);
@@ -613,7 +610,7 @@ delete_tile (ShumateFileCache *file_cache, const char *filename)
file = g_file_new_for_path (filename);
if (!g_file_delete (file, NULL, &gerror))
{
- DEBUG ("Deleting tile from disk failed: %s", gerror->message);
+ g_debug ("Deleting tile from disk failed: %s", gerror->message);
g_error_free (gerror);
}
g_object_unref (file);
@@ -670,13 +667,13 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
rc = sqlite3_prepare (priv->db, query, strlen (query), &stmt, NULL);
if (rc != SQLITE_OK)
{
- DEBUG ("Can't compute cache size %s", sqlite3_errmsg (priv->db));
+ g_debug ("Can't compute cache size %s", sqlite3_errmsg (priv->db));
}
rc = sqlite3_step (stmt);
if (rc != SQLITE_ROW)
{
- DEBUG ("Failed to count the total cache consumption %s",
+ g_debug ("Failed to count the total cache consumption %s",
sqlite3_errmsg (priv->db));
sqlite3_finalize (stmt);
return;
@@ -685,7 +682,7 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
current_size = sqlite3_column_int (stmt, 0);
if (current_size < priv->size_limit)
{
- DEBUG ("Cache doesn't need to be purged at %d bytes", current_size);
+ g_debug ("Cache doesn't need to be purged at %d bytes", current_size);
sqlite3_finalize (stmt);
return;
}
@@ -697,7 +694,7 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
rc = sqlite3_prepare (priv->db, query, strlen (query), &stmt, NULL);
if (rc != SQLITE_OK)
{
- DEBUG ("Can't fetch tiles to delete: %s", sqlite3_errmsg (priv->db));
+ g_debug ("Can't fetch tiles to delete: %s", sqlite3_errmsg (priv->db));
}
rc = sqlite3_step (stmt);
@@ -709,7 +706,7 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
filename = (const char *) sqlite3_column_text (stmt, 0);
size = sqlite3_column_int (stmt, 1);
highest_popularity = sqlite3_column_int (stmt, 2);
- DEBUG ("Deleting %s of size %d", filename, size);
+ g_debug ("Deleting %s of size %d", filename, size);
delete_tile (file_cache, filename);
@@ -717,7 +714,7 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
rc = sqlite3_step (stmt);
}
- DEBUG ("Cache size is now %d", current_size);
+ g_debug ("Cache size is now %d", current_size);
sqlite3_finalize (stmt);
@@ -726,7 +723,7 @@ shumate_file_cache_purge (ShumateFileCache *file_cache)
sqlite3_exec (priv->db, query, NULL, NULL, &error);
if (error != NULL)
{
- DEBUG ("Updating popularity failed: %s", error);
+ g_debug ("Updating popularity failed: %s", error);
sqlite3_free (error);
}
sqlite3_free (query);
@@ -935,7 +932,7 @@ shumate_file_cache_store_tile_async (ShumateFileCache *self,
filename = get_filename (self, tile);
file = g_file_new_for_path (filename);
- DEBUG ("Update of %p", tile);
+ g_debug ("Update of %p", tile);
/* If needed, create the cache's dirs */
path = g_path_get_dirname (filename);
diff --git a/shumate/shumate-map-source-factory.c b/shumate/shumate-map-source-factory.c
index 477aa03..fddb1f2 100644
--- a/shumate/shumate-map-source-factory.c
+++ b/shumate/shumate-map-source-factory.c
@@ -37,9 +37,6 @@
#include "shumate-map-source-factory.h"
-#define DEBUG_FLAG SHUMATE_DEBUG_NETWORK
-#include "shumate-debug.h"
-
#include "shumate.h"
#include "shumate-enum-types.h"
#include "shumate-map-source.h"
diff --git a/shumate/shumate-memory-cache.c b/shumate/shumate-memory-cache.c
index 17181f8..acbe5d7 100644
--- a/shumate/shumate-memory-cache.c
+++ b/shumate/shumate-memory-cache.c
@@ -27,9 +27,6 @@
* most recently used tiles.
*/
-#define DEBUG_FLAG SHUMATE_DEBUG_CACHE
-#include "shumate-debug.h"
-
#include "shumate-memory-cache.h"
#include <glib.h>
diff --git a/shumate/shumate-network-tile-source.c b/shumate/shumate-network-tile-source.c
index 8c4a4e7..d1a1b94 100644
--- a/shumate/shumate-network-tile-source.c
+++ b/shumate/shumate-network-tile-source.c
@@ -34,9 +34,6 @@
#include "shumate-network-tile-source.h"
-#define DEBUG_FLAG SHUMATE_DEBUG_LOADING
-#include "shumate-debug.h"
-
#include "shumate.h"
#include "shumate-enum-types.h"
#include "shumate-map-source.h"
@@ -819,13 +816,13 @@ fetch_from_network (GTask *task)
*/
if (data->etag)
{
- DEBUG ("If-None-Match: %s", data->etag);
+ g_debug ("If-None-Match: %s", data->etag);
soup_message_headers_append (data->msg->request_headers,
"If-None-Match", data->etag);
}
else if (modtime_string)
{
- DEBUG ("If-Modified-Since %s", modtime_string);
+ g_debug ("If-Modified-Since %s", modtime_string);
soup_message_headers_append (data->msg->request_headers,
"If-Modified-Since", modtime_string);
}
@@ -852,7 +849,7 @@ on_message_sent (GObject *source_object, GAsyncResult *res, gpointer user_data)
return;
}
- DEBUG ("Got reply %d", data->msg->status_code);
+ g_debug ("Got reply %d", data->msg->status_code);
if (data->msg->status_code == SOUP_STATUS_NOT_MODIFIED)
{
@@ -879,7 +876,7 @@ on_message_sent (GObject *source_object, GAsyncResult *res, gpointer user_data)
/* Verify if the server sent an etag and save it */
g_clear_pointer (&data->etag, g_free);
data->etag = g_strdup (soup_message_headers_get_one (data->msg->response_headers, "ETag"));
- DEBUG ("Received ETag %s", data->etag);
+ g_debug ("Received ETag %s", data->etag);
gdk_pixbuf_new_from_stream_async (input_stream, cancellable, on_pixbuf_created, g_object_ref (task));
}
diff --git a/shumate/shumate-view.c b/shumate/shumate-view.c
index 7c3bbb7..c01b59d 100644
--- a/shumate/shumate-view.c
+++ b/shumate/shumate-view.c
@@ -50,9 +50,6 @@
#include "shumate-view.h"
-#define DEBUG_FLAG SHUMATE_DEBUG_VIEW
-#include "shumate-debug.h"
-
#include "shumate.h"
#include "shumate-enum-types.h"
#include "shumate-kinetic-scrolling-private.h"
@@ -907,8 +904,6 @@ shumate_view_init (ShumateView *view)
GtkGesture *swipe_gesture;
GtkGesture *zoom_gesture;
- shumate_debug_set_flags (g_getenv ("SHUMATE_DEBUG"));
-
priv->viewport = shumate_viewport_new ();
priv->zoom_on_double_click = TRUE;
priv->animate_zoom = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]