[epiphany] EphyUriTester: Avoid g_strdup() when a boolean is enough
- From: Emanuele Aina <emaaa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] EphyUriTester: Avoid g_strdup() when a boolean is enough
- Date: Thu, 12 Nov 2015 14:17:46 +0000 (UTC)
commit e17dc3627218aed60e2fa61486757b55dc804b6e
Author: Emanuele Aina <emanuele aina collabora com>
Date: Wed Nov 11 12:54:02 2015 +0000
EphyUriTester: Avoid g_strdup() when a boolean is enough
https://bugzilla.gnome.org/show_bug.cgi?id=754954
embed/web-extension/ephy-uri-tester.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/embed/web-extension/ephy-uri-tester.c b/embed/web-extension/ephy-uri-tester.c
index 696d6eb..f8a2d82 100644
--- a/embed/web-extension/ephy-uri-tester.c
+++ b/embed/web-extension/ephy-uri-tester.c
@@ -372,16 +372,16 @@ ephy_uri_tester_is_matched (EphyUriTester *tester,
/* Check cached URLs first. */
if ((value = g_hash_table_lookup (urlcache, req_uri)))
- return (value[0] != '0') ? TRUE : FALSE;
+ return GPOINTER_TO_INT (value);
/* Matching by pattern is pretty expensive, so do it if needed only. */
if (ephy_uri_tester_is_matched_by_pattern (tester, req_uri, page_uri, whitelist))
{
- g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("1"));
+ g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
return TRUE;
}
- g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("0"));
+ g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (FALSE));
return FALSE;
}
@@ -746,7 +746,7 @@ ephy_uri_tester_init (EphyUriTester *tester)
(GDestroyNotify)g_free);
tester->urlcache = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free,
- (GDestroyNotify)g_free);
+ NULL);
tester->whitelisted_pattern = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free,
@@ -756,7 +756,7 @@ ephy_uri_tester_init (EphyUriTester *tester)
(GDestroyNotify)g_free);
tester->whitelisted_urlcache = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free,
- (GDestroyNotify)g_free);
+ NULL);
tester->blockcss = g_string_new ("z-non-exist");
tester->blockcssprivate = g_string_new ("");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]