soc.2008.themes: 6075bb44: Fixed some leaks formatting

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Tue Jun 10 23:55:43 EDT 2008


-----------------------------------------------------------------
Revision: 6075bb449c4c3cb30d755ac7e8b39f7f6f08106f
Ancestor: ffa766fcace95adc027d03fe5a19d60f628a1e89
Author: ffdragon at soc.pidgin.im
Date: 2008-06-11T03:51:47
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/6075bb449c4c3cb30d755ac7e8b39f7f6f08106f

Modified files:
        libpurple/theme-manager.c

ChangeLog: 

Fixed some leaks formatting

-------------- next part --------------
============================================================
--- libpurple/theme-manager.c	58f6ff4aa6595947b2c4f1c2570bd8df061619ce
+++ libpurple/theme-manager.c	b8682b52cfbd1080ac8a4976d5d7107c03dea722
@@ -111,7 +111,7 @@ purple_theme_manager_function_wrapper(gc
                   		      gpointer value,
                 		      PTFunc user_data)
 {
-	if(PURPLE_IS_THEME(value))
+	if (PURPLE_IS_THEME(value))
 		(* user_data) (value);
 }
 
@@ -120,36 +120,38 @@ purple_theme_manager_build(const gchar *
 {
 
 	GDir *rdir;
-	gchar *name, *type;
+	gchar *name, *type, *purple_dir, *theme_dir;
 	GDir *dir;
 	PurpleThemeLoader *loader;
 
-	rdir =  g_dir_open(root, 0, NULL);/*TODO: should have debug error?*/
+	rdir =  g_dir_open(root, 0, NULL);
 
 	g_return_if_fail(rdir);
 
-	/*TODO: This looks messy, leaks*/
 	/* Parses directory by root/name/purple/type */
-	while((name = g_strdup(g_dir_read_name (rdir)))){
-
-		dir =  g_dir_open(g_strconcat(root, '/', name,
-				  '/', "purple", NULL), 0, NULL);	
+	while ((name = g_strdup(g_dir_read_name (rdir)))){
+		
+		purple_dir = g_strconcat(root, '/', name, '/', "purple", NULL);
+		dir =  g_dir_open(purple_dir, 0, NULL);	
 	
-		if(dir) {
-			while((type = g_strdup(g_dir_read_name (dir)))) {
-				if((loader = g_hash_table_lookup (theme_table, type)))
-					purple_theme_manager_add_theme(purple_theme_loader_build(loader,  g_strconcat(root, '/', name, '/',
-												              "purple", '/', type, NULL)));
+		if (dir) {
+			while ((type = g_strdup(g_dir_read_name (dir)))) {
+				if ((loader = g_hash_table_lookup (theme_table, type))){
 
+					theme_dir = g_strconcat(purple_dir, '/', type, NULL);
+					purple_theme_manager_add_theme(purple_theme_loader_build(loader, theme_dir));
+
+				}
 				g_free(type);
+
 			}
-
 			g_dir_close(dir);
+
 		}
-
-		g_free(name);		
+		g_free(purple_dir);
+		g_free(name);	
+	
 	}
-
 	g_dir_close(rdir);
 	
 }
@@ -190,7 +192,7 @@ purple_theme_manager_register_type(Purpl
 	g_return_if_fail(type);
 
 	/* if something is already there do nothing */
-	if(! g_hash_table_lookup (theme_table, type)) 
+	if (! g_hash_table_lookup (theme_table, type)) 
 		g_hash_table_insert(theme_table, type, loader);
 	
 	g_free(type);
@@ -206,7 +208,7 @@ purple_theme_manager_unregister_type(Pur
 	type = purple_theme_loader_get_type_string(loader);
 	g_return_if_fail(type);
 
-	if(g_hash_table_lookup (theme_table, type) == loader){
+	if (g_hash_table_lookup (theme_table, type) == loader){
 
 		g_hash_table_remove (theme_table, type);
 
@@ -243,7 +245,7 @@ purple_theme_manager_add_theme(PurpleThe
 	g_return_if_fail(key);
 	
 	/* if something is already there do nothing */
-	if(! g_hash_table_lookup (theme_table, key)) 
+	if (! g_hash_table_lookup (theme_table, key)) 
 		g_hash_table_insert(theme_table, key, theme);
 	
 	g_free(key);	


More information about the Commits mailing list