[Xfce4-commits] <squeeze:master> Cleanup slist.{c,h} files

Stephan Arts noreply at xfce.org
Mon Oct 3 00:40:01 CEST 2011


Updating branch refs/heads/master
         to 88f6f1e9a3a146be7647ec11ad0192599442c810 (commit)
       from 3120ecf68a1953f8a34dfd539fcebedbd4ab5230 (commit)

commit 88f6f1e9a3a146be7647ec11ad0192599442c810
Author: Stephan Arts <stephan at xfce.org>
Date:   Mon Oct 3 00:20:51 2011 +0200

    Cleanup slist.{c,h} files

 libsqueeze/slist.c |  101 ++++++++++++++++++++++++++++-----------------------
 libsqueeze/slist.h |    9 +++--
 2 files changed, 61 insertions(+), 49 deletions(-)

diff --git a/libsqueeze/slist.c b/libsqueeze/slist.c
index 9af9088..b15cd8a 100644
--- a/libsqueeze/slist.c
+++ b/libsqueeze/slist.c
@@ -27,74 +27,83 @@
 #include "slist.h"
 
 LSQSList *
-lsq_slist_insert_sorted_single(LSQSList *list, LSQArchiveEntry *entry, GCompareFunc cmp_func)
+lsq_slist_insert_sorted_single ( 
+        LSQSList *list,
+        LSQArchiveEntry *entry,
+        GCompareFunc cmp_func)
 {
-	gint cmp = 1;
-	LSQSList *iter = list;
-	LSQSList *prev_entry = NULL;
-	LSQSList *new_entry = NULL;
+    gint cmp = 1;
+    LSQSList *iter = list;
+    LSQSList *prev_entry = NULL;
+    LSQSList *new_entry = NULL;
 
-	for(; iter; iter = iter->next)
-	{
-		/* archive can be NULL */
-		cmp = cmp_func(entry, (LSQArchiveEntry*)iter->entry);
+    for(; iter; iter = iter->next)
+    {
+        /* archive can be NULL */
+        cmp = cmp_func(entry, (LSQArchiveEntry*)iter->entry);
 
-		if(!cmp)
-		{
-			g_critical("THIS SHOULD NOT HAPPEN!!! (the universe has just collapsed)");
-			return NULL;
-		}
-		if(cmp < 0)
-			break;
+        if ( 0 == cmp )
+        {
+            g_critical("THIS SHOULD NOT HAPPEN!!! (the universe has just collapsed)");
+            return NULL;
+        }
+        if ( 0 > cmp )
+        {
+            break;
+        }
 
-		prev_entry = iter;
-	}
+        prev_entry = iter;
+    }
 
-	new_entry = g_new0(LSQSList, 1);
-	new_entry->next = iter;
-	new_entry->entry = entry;
+    new_entry = g_new0(LSQSList, 1);
+    new_entry->next = iter;
+    new_entry->entry = entry;
 
-	if(!prev_entry)
-		return new_entry;
-	
-	prev_entry->next = new_entry;
-	return list;
+    if ( NULL == prev_entry )
+    {
+        return new_entry;
+    }
+    
+    prev_entry->next = new_entry;
+    return list;
 }
 
 guint
-lsq_slist_length(LSQSList *list)
+lsq_slist_length ( LSQSList *list )
 {
-	guint size = 0;
-	for(; list; list = list->next)
-		size++;
-	return size;
+    guint size = 0;
+    for(; list; list = list->next)
+    {
+        size++;
+    }
+    return size;
 }
 
 void
-lsq_slist_free(LSQSList *list)
+lsq_slist_free ( LSQSList *list )
 {
-	LSQSList *next;
-	for(; list; list = next)
-	{
-		next = list->next;
-		g_free(list);
-	}
+    LSQSList *next;
+    for(; list; list = next)
+    {
+        next = list->next;
+        g_free(list);
+    }
 }
 
 LSQSIndexList *
 lsq_slist_index_new(void)
 {
-	return g_new0(LSQSIndexList, 1);
+    return g_new0(LSQSIndexList, 1);
 }
 
 void
-lsq_slist_index_free(LSQSIndexList *list)
+lsq_slist_index_free ( LSQSIndexList *list )
 {
-	LSQSIndexList *next;
-	for(; list; list = next)
-	{
-		next = list->next;
-		g_free(list);
-	}
+    LSQSIndexList *next;
+    for(; list; list = next)
+    {
+        next = list->next;
+        g_free(list);
+    }
 }
 
diff --git a/libsqueeze/slist.h b/libsqueeze/slist.h
index 37f6d8a..4772afc 100644
--- a/libsqueeze/slist.h
+++ b/libsqueeze/slist.h
@@ -25,7 +25,10 @@ struct _LSQSList {
 };
 
 LSQSList *
-lsq_slist_insert_sorted_single(LSQSList *list, LSQArchiveEntry *entry, GCompareFunc) G_GNUC_INTERNAL;
+lsq_slist_insert_sorted_single (
+        LSQSList *list,
+        LSQArchiveEntry *entry,
+        GCompareFunc) G_GNUC_INTERNAL;
 
 guint
 lsq_slist_length(LSQSList *list) G_GNUC_INTERNAL;
@@ -36,8 +39,8 @@ lsq_slist_free(LSQSList *list) G_GNUC_INTERNAL;
 typedef struct _LSQSIndexList LSQSIndexList;
 
 struct _LSQSIndexList {
-	LSQSList *index;
-	LSQSIndexList *next;
+    LSQSList *index;
+    LSQSIndexList *next;
 };
 
 LSQSIndexList *


More information about the Xfce4-commits mailing list