[epiphany] embed-utils: remove extra indentation level in method
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] embed-utils: remove extra indentation level in method
- Date: Tue, 4 Sep 2012 13:42:25 +0000 (UTC)
commit c11081599dd7f6b9f2c1fd627afa8af93d99fa0e
Author: Xan Lopez <xan igalia com>
Date: Tue Sep 4 15:32:55 2012 +0200
embed-utils: remove extra indentation level in method
The whole method is inside an if block, just do an early return.
embed/ephy-embed-utils.c | 51 +++++++++++++++++++++------------------------
1 files changed, 24 insertions(+), 27 deletions(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 6d4b98a..5ffa4f0 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -37,40 +37,37 @@ ephy_embed_utils_link_message_parse (const char *message)
char *status_message;
char **splitted_message;
+ int i = 1;
+ char *p;
+ GString *tmp;
status_message = ephy_string_blank_chr (g_strdup (message));
- if (status_message && g_str_has_prefix (status_message, "mailto:")) {
- int i = 1;
- char *p;
- GString *tmp;
-
- /* We first want to eliminate all the things after "?", like
- * cc, subject and alike.
- */
-
- p = strchr (status_message, '?');
- if (p != NULL) *p = '\0';
-
- /* Then we also want to check if there is more than an email address
- * in the mailto: list.
- */
+ if (!status_message || !g_str_has_prefix (status_message, "mailto:"))
+ return status_message;
+
+ /* We first want to eliminate all the things after "?", like cc,
+ * subject and alike.
+ */
+ p = strchr (status_message, '?');
+ if (p != NULL) *p = '\0';
- splitted_message = g_strsplit_set (status_message, ";", -1);
- tmp = g_string_new (g_strdup_printf (_("Send an email message to â%sâ"),
- (splitted_message[0] + 7)));
+ /* Then we also want to check if there is more than an email address
+ * in the mailto: list.
+ */
+ splitted_message = g_strsplit_set (status_message, ";", -1);
+ tmp = g_string_new (g_strdup_printf (_("Send an email message to â%sâ"),
+ (splitted_message[0] + 7)));
- while (splitted_message [i] != NULL) {
- g_string_append_printf (tmp, ", â%sâ", splitted_message[i]);
- i++;
- }
+ while (splitted_message [i] != NULL) {
+ g_string_append_printf (tmp, ", â%sâ", splitted_message[i]);
+ i++;
+ }
- g_free (status_message);
- g_strfreev (splitted_message);
+ g_free (status_message);
+ g_strfreev (splitted_message);
- return g_string_free (tmp, FALSE);
- } else
- return status_message;
+ return g_string_free (tmp, FALSE);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]