[balsa/gtk3] Simplify code



commit db42581c669795fec7aa41ecace391836fa6efe1
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 15 22:54:06 2012 -0400

    Simplify code
    
    	* src/mailbox-node.c (balsa_mailbox_local_append): simplify.

 ChangeLog          |    4 ++++
 src/mailbox-node.c |    9 ++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 054c6f4..0b59b56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-07-15  Peter Bloomfield
 
+	* src/mailbox-node.c (balsa_mailbox_local_append): simplify.
+
+2012-07-15  Peter Bloomfield
+
 	* libbalsa/mailbox_imap.c (imap_cache_manager_new_from_file): do
 	not leak FILE on error.
 
diff --git a/src/mailbox-node.c b/src/mailbox-node.c
index eb1c7c4..f98eb3b 100644
--- a/src/mailbox-node.c
+++ b/src/mailbox-node.c
@@ -725,16 +725,15 @@ find_dir(const gchar * dir)
 void
 balsa_mailbox_local_append(LibBalsaMailbox* mbx)
 {
-    gchar *dir; 
+    gchar *dir;
     BalsaMailboxNode *mbnode;
     BalsaMailboxNode *parent = NULL;
 
     g_return_if_fail(LIBBALSA_IS_MAILBOX_LOCAL(mbx));
 
-    for(dir = g_strdup(libbalsa_mailbox_local_get_path(mbx));
-        strlen(dir)>1 /* i.e dir != "/" */ &&
-            !(parent = find_dir(dir));
-        ) {
+    dir = g_strdup(libbalsa_mailbox_local_get_path(mbx));
+    while (dir[1] /* i.e. dir != "/" */
+           && !(parent = find_dir(dir))) {
         gchar* tmp =  g_path_get_dirname(dir);
         g_free(dir);
         dir = tmp;



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