[easytag/wip/glist: 6/12] Refactor list handling in log.c



commit 8893f2f36df7328677d3e78a3a3806f75767b939
Author: David King <amigadave amigadave com>
Date:   Thu May 23 19:59:47 2013 +0100

    Refactor list handling in log.c

 src/log.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/log.c b/src/log.c
index de2943d..cfdc9f8 100644
--- a/src/log.c
+++ b/src/log.c
@@ -413,21 +413,20 @@ Log_Print_Tmp_List (void)
     // Free the list...
     if (LogPrintTmpList)
     {
-        LogPrintTmpList = g_list_first(LogPrintTmpList);
-        while (LogPrintTmpList)
-        {
-            g_free(((Log_Data *)LogPrintTmpList->data)->string);
-            g_free(((Log_Data *)LogPrintTmpList->data)->time);
-            g_free(((Log_Data *)LogPrintTmpList->data));
+        GList *l;
+
+        LogPrintTmpList = g_list_first (LogPrintTmpList);
 
-            if (!LogPrintTmpList->next) break;
-            LogPrintTmpList = LogPrintTmpList->next;
+        for (l = LogPrintTmpList; l != NULL; l = g_list_next (l))
+        {
+            g_free (((Log_Data *)l->data)->string);
+            g_free (((Log_Data *)l->data)->time);
+            g_free (((Log_Data *)l->data));
         }
 
-        g_list_free(LogPrintTmpList);
+        g_list_free (LogPrintTmpList);
         LogPrintTmpList = NULL;
     }
-
 }
 
 


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