Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_desktop


Modified Files:
        ecore_desktop_icon.c 


Log Message:
Frre up ram.  Re organised a little to make freeing ram easier.

===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ecore_desktop_icon.c        13 Sep 2006 03:57:09 -0000      1.18
+++ ecore_desktop_icon.c        22 Sep 2006 03:38:11 -0000      1.19
@@ -75,10 +75,7 @@
 
          dir = _ecore_desktop_icon_find0(icn, icon_size, icon_theme);
          if (dir)
-          {
-//           dir = strdup(dir);
-             break;
-          }
+            break;
       }
    ecore_list_destroy(icons);
 
@@ -124,7 +121,7 @@
 
    char                icn[PATH_MAX], path[PATH_MAX];
    char               *theme_path;
-   const char         *found;
+   char               *found = NULL;
 
    if ((icon == NULL) || (icon[0] == '\0'))
       return NULL;
@@ -180,7 +177,7 @@
                            int                 wanted_size;
                            int                 minimal_size = INT_MAX;
                            int                 i;
-                           const char         *closest = NULL;
+                           char               *closest = NULL;
                            char               *directory;
 
                            wanted_size = atoi(icon_size);
@@ -309,12 +306,8 @@
                                                if (found)
                                                  {
                                                     if (match) /* If there is 
a match in sizes, return the icon. */
-                                                      {
-                                                         
ecore_list_destroy(directory_paths);
-                                                         free(theme_path);
-                                                         return found;
-                                                      }
-                                                    if (result_size < 
minimal_size)    /* While we are here, figure out our next fallback strategy. */
+                                                       break;
+                                                    else if (result_size < 
minimal_size) /* While we are here, figure out our next fallback strategy. */
                                                       {
                                                          minimal_size =
                                                             result_size;
@@ -322,79 +315,70 @@
                                                          closest = found;
                                                       }
                                                     else
-                                                      free(found);
+                                                       {
+                                                          free(found);
+                                                          found = NULL;
+                                                       }
                                                  }
                                             }
 
-                                       }
-                                  }
+                                       } /* if (size) */
+                                  } /* if (sub_group) */
+                                  if (found)
+                                     break;
                              } /* while ((directory = 
ecore_list_next(directory_paths)) != NULL) */
 
-                           /* Fall back strategy #1, look for closest size in 
this theme. */
-                           if (closest)
-                             {
-                                ecore_list_destroy(directory_paths);
-                                free(theme_path);
-                                return closest;
-                             }
-
-                           /* Fall back strategy #2, Try again with the parent 
theme. */
-                           if ((inherits) && (inherits[0] != '\0')
-                               && (strcmp(icon_theme, "hicolor") != 0))
-                             {
-                                found =
-                                   _ecore_desktop_icon_find0(icon, icon_size,
+                            if (!found)
+                              {
+                                 /* Fall back strategy #1, look for closest 
size in this theme. */
+                                 found = closest;
+
+                                 /* Fall back strategy #2, Try again with the 
parent theme. */
+                                 if ((!found) && (inherits) && (inherits[0] != 
'\0')
+                                     && (strcmp(icon_theme, "hicolor") != 0))
+                                   {
+                                      found = (char *)
+                                         _ecore_desktop_icon_find0(icon, 
icon_size,
                                                              inherits);
-                                if (found != NULL)
-                                  {
-                                     ecore_list_destroy(directory_paths);
-                                     free(theme_path);
-                                     return found;
-                                  }
-                             }
-
-                           /* Fall back strategy #3, Try the default hicolor 
theme. */
-                           if ((!((inherits) && (inherits[0] != '\0')))
-                               && (strcmp(icon_theme, "hicolor") != 0))
-                             {
-                                found =
-                                   _ecore_desktop_icon_find0(icon, icon_size,
+                                   }
+
+                                 /* Fall back strategy #3, Try the default 
hicolor theme. */
+                                 if ((!found) && (!((inherits) && (inherits[0] 
!= '\0')))
+                                     && (strcmp(icon_theme, "hicolor") != 0))
+                                   {
+                                      found = (char *)
+                                         _ecore_desktop_icon_find0(icon, 
icon_size,
                                                              "hicolor");
-                                if (found != NULL)
-                                  {
-                                     ecore_list_destroy(directory_paths);
-                                     free(theme_path);
-                                     return found;
-                                  }
-                             }
+                                   }
 
-                           /* Fall back strategy #4, Just search in the base 
of the icon directories. */
-                           for (i = 0; ext[i] != NULL; i++)
-                             {
-                                snprintf(path, PATH_MAX, "%s%s", icon, ext[i]);
+                                  if (!found)
+                                    {
+                                       /* Fall back strategy #4, Just search 
in the base of the icon directories. */
+                                       for (i = 0; ext[i] != NULL; i++)
+                                         {
+                                            snprintf(path, PATH_MAX, "%s%s", 
icon, ext[i]);
 #ifdef DEBUG
-                                printf("FDO icon = %s\n", path);
+                                            printf("FDO icon = %s\n", path);
 #endif
-                                found =
-                                   ecore_desktop_paths_file_find
-                                   (ecore_desktop_paths_icons, path, 0, NULL,
-                                    NULL);
-                                if (found)
-                                  {
-                                     ecore_list_destroy(directory_paths);
-                                     free(theme_path);
-                                     return found;
-                                  }
-                             }
+                                            found =
+                                               ecore_desktop_paths_file_find
+                                               (ecore_desktop_paths_icons, 
path, 0, NULL,
+                                                NULL);
+                                            if (found)
+                                               break;
+                                         }
+                                    }
+                              }
                            ecore_list_destroy(directory_paths);
-                        }
-                   }
-              }
-         }
+                        } /* if (directory_paths) */
+                   } /* if (directories) */
+              } /* if (icon_group) */
+            ecore_hash_destroy(theme);
+         } /*  */
        free(theme_path);
-     }
+     } /* if (theme_path) */
 
-   return NULL;
+   return found;
 }
 
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to