Commit d77ba519 authored by Michael Catanzaro's avatar Michael Catanzaro

Purge unnecessary use of g_str_equal

This function is intended for use in hash tables.
parent 4436c462
......@@ -12,4 +12,3 @@ Some TODO items, in no particular order:
- We practically don't test any part of Epiphany, change that (how do
you test UI code? There's like 3 or 4 frameworks for this, pick one?
What does Chrome do?)
- g_str_equal -> g_strcmp0 or strcmp except in hash maps
......@@ -244,7 +244,7 @@ normalize_languages (char **languages)
langs = g_ptr_array_new ();
for (i = 0; languages && languages[i]; i++) {
if (g_str_equal (languages[i], "system")) {
if (!strcmp (languages[i], "system")) {
char **sys_langs = ephy_langs_get_languages ();
int j;
......@@ -314,11 +314,11 @@ ephy_embed_prefs_set_cookie_accept_policy (WebKitCookieManager *cookie_manager,
{
WebKitCookieAcceptPolicy policy;
if (g_str_equal (settings_policy, "never"))
if (!strcmp (settings_policy, "never"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_NEVER;
else if (g_str_equal (settings_policy, "always"))
else if (!strcmp (settings_policy, "always"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
else if (g_str_equal (settings_policy, "no-third-party"))
else if (!strcmp (settings_policy, "no-third-party"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY;
else {
g_warn_if_reached ();
......
......@@ -151,7 +151,7 @@ is_public_domain (const char *address)
return FALSE;
if (g_regex_match (get_domain_regex (), host, 0, NULL)) {
if (g_str_equal (host, "localhost"))
if (!strcmp (host, "localhost"))
retval = TRUE;
else {
const char *end;
......@@ -237,7 +237,7 @@ ephy_embed_utils_normalize_address (const char *address)
if (ephy_embed_utils_address_is_existing_absolute_filename (address))
return g_strconcat ("file://", address, NULL);
if (g_str_has_prefix (address, "about:") && !g_str_equal (address, "about:blank"))
if (g_str_has_prefix (address, "about:") && strcmp (address, "about:blank"))
return g_strconcat (EPHY_ABOUT_SCHEME, address + strlen ("about"), NULL);
if (!ephy_embed_utils_address_has_web_scheme (address)) {
......@@ -327,7 +327,7 @@ ephy_embed_utils_is_no_show_address (const char *address)
return FALSE;
for (i = 0; do_not_show_address[i]; i++)
if (g_str_equal (address, do_not_show_address[i]))
if (!strcmp (address, do_not_show_address[i]))
return TRUE;
return FALSE;
......
......@@ -603,7 +603,7 @@ pre_fill_form (EphyEmbedFormAuth *form_auth)
g_object_get (password_node, "name", &password_field_name, NULL);
/* The username node is empty, so pre-fill with the default. */
if (username != NULL && g_str_equal (username, ""))
if (!g_strcmp0 (username, ""))
g_clear_pointer (&username, g_free);
uri_str = soup_uri_to_string (uri, FALSE);
......
......@@ -141,9 +141,9 @@ ephy_file_get_downloads_dir (void)
download_dir = g_settings_get_string (EPHY_SETTINGS_STATE,
EPHY_PREFS_STATE_DOWNLOAD_DIR);
if (g_str_equal (download_dir, "Desktop"))
if (!g_strcmp0 (download_dir, "Desktop"))
download_dir = ephy_file_desktop_dir ();
if (g_str_equal (download_dir, "Downloads") ||
if (!g_strcmp0 (download_dir, "Downloads") ||
g_path_is_absolute (download_dir) != TRUE)
download_dir = ephy_file_download_dir ();
......
......@@ -250,19 +250,19 @@ static void ephy_smaps_pid_to_html (EphySMaps *smaps, GString *str, pid_t pid, E
char *name = g_match_info_fetch (match_info, 1);
char **size = NULL;
if (g_str_equal (name, "Size"))
if (!strcmp (name, "Size"))
size = &vma->size;
else if (g_str_equal (name, "Rss"))
else if (!strcmp (name, "Rss"))
size = &vma->rss;
else if (g_str_equal (name, "Pss"))
else if (!strcmp (name, "Pss"))
size = &vma->pss;
else if (g_str_equal (name, "Shared_Clean"))
else if (!strcmp (name, "Shared_Clean"))
size = &vma->shared_clean;
else if (g_str_equal (name, "Shared_Dirty"))
else if (!strcmp (name, "Shared_Dirty"))
size = &vma->shared_dirty;
else if (g_str_equal (name, "Private_Clean"))
else if (!strcmp (name, "Private_Clean"))
size = &vma->private_clean;
else if (g_str_equal (name, "Private_Dirty"))
else if (!strcmp (name, "Private_Dirty"))
size = &vma->private_dirty;
if (size)
......@@ -421,7 +421,7 @@ static void ephy_smaps_pid_children_to_html (EphySMaps *smaps, GString *str, pid
pid_t pid, ppid;
EphyProcess process;
if (g_str_equal (name, "self"))
if (!strcmp (name, "self"))
continue;
pid = get_pid_from_proc_name (name);
......
......@@ -182,7 +182,7 @@ is_garbage (const char *name,
if (fields[i].host != NULL &&
!g_str_has_suffix (host, fields[i].host))
continue;
if (g_str_equal (fields[i].field, name))
if (!g_strcmp0 (fields[i].field, name))
return TRUE;
}
......
......@@ -364,7 +364,7 @@ get_hostname_and_locations (const gchar *url, gchar **hostname)
char *location;
char *tmp;
if (g_str_equal (scheme, "https")) {
if (!strcmp (scheme, "https")) {
/* If scheme is https, we still fake http. */
location = g_strconcat ("http://", *hostname, "/", NULL);
host_locations = g_list_append (host_locations, location);
......
......@@ -563,7 +563,7 @@ session_tab_new (EphyEmbed *embed,
/* Do not store ephy-about: URIs, they are not valid for loading. */
if (g_str_has_prefix (address, EPHY_ABOUT_SCHEME)) {
session_tab->url = g_strconcat ("about", address + EPHY_ABOUT_SCHEME_LEN, NULL);
} else if (g_str_equal (address, "about:blank")) {
} else if (!strcmp (address, "about:blank")) {
/* EphyWebView address is NULL between load_uri() and WEBKIT_LOAD_STARTED,
* but WebKitWebView knows the pending API request URL, so use that instead of about:blank.
*/
......
......@@ -1124,7 +1124,7 @@ open_uris_data_new (EphyShell *shell,
fullscreen_lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
EPHY_PREFS_LOCKDOWN_FULLSCREEN);
have_uris = uris && !(g_strv_length ((char **)uris) == 1 && g_str_equal (uris[0], ""));
have_uris = uris && !(g_strv_length ((char **)uris) == 1 && !g_strcmp0 (uris[0], ""));
if (startup_flags & EPHY_STARTUP_NEW_WINDOW && !fullscreen_lockdown) {
data->window = ephy_window_new ();
......
......@@ -781,7 +781,7 @@ migrate_adblock_filters (void)
char *url;
url = g_strstrip (filter_list[i]);
if (url[0] != '\0' && !g_str_equal (url, ADBLOCK_DEFAULT_FILTER_URL))
if (url[0] != '\0' && strcmp (url, ADBLOCK_DEFAULT_FILTER_URL))
g_ptr_array_add (filters_array, g_strdup (url));
}
......@@ -868,7 +868,7 @@ static gboolean
is_deprecated_setting (const char *setting)
{
for (guint i = 0; i < G_N_ELEMENTS (deprecated_settings); i++) {
if (g_str_equal (setting, deprecated_settings[i]))
if (!strcmp (setting, deprecated_settings[i]))
return TRUE;
}
......
......@@ -57,7 +57,7 @@ server_callback (SoupServer *server,
{
soup_message_set_status (msg, SOUP_STATUS_OK);
if (g_str_equal (path, "/cancelled"))
if (!strcmp (path, "/cancelled"))
soup_message_set_status (msg, SOUP_STATUS_CANT_CONNECT);
soup_message_body_append (msg->response_body, SOUP_MEMORY_STATIC,
......
......@@ -46,9 +46,9 @@ server_callback (SoupServer *server,
SoupClientContext *context,
gpointer data)
{
if (g_str_equal (path, "/cancelled"))
if (!strcmp (path, "/cancelled"))
soup_message_set_status (msg, SOUP_STATUS_CANT_CONNECT);
else if (g_str_equal (path, "/redirect")) {
else if (!strcmp (path, "/redirect")) {
soup_message_set_status (msg, SOUP_STATUS_MOVED_PERMANENTLY);
soup_message_headers_append (msg->response_headers, "Location", "/redirect-result");
} else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment