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

[E-devel] [PATCH] ecore_desktop_icon_find add const



Hello,

Attached is a patch to make the ecore_desktop_icon_find function use and return const strings. It doesn't appear to modify these strings (and it still works once constified).

But, I wanted to send it here before committing it as I'm not sure if this code is changing in ecore_desktop or not.

dan
Index: Ecore_Desktop.h
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/Ecore_Desktop.h,v
retrieving revision 1.7
diff -u -r1.7 Ecore_Desktop.h
--- Ecore_Desktop.h	14 Aug 2006 21:42:53 -0000	1.7
+++ Ecore_Desktop.h	16 Aug 2006 20:43:17 -0000
@@ -133,8 +133,9 @@
    Ecore_Desktop      *ecore_desktop_get(const char *file, const char *lang);
    void                ecore_desktop_destroy(Ecore_Desktop * desktop);
 
-   char               *ecore_desktop_icon_find(char *icon, char *icon_size,
-					       char *icon_theme);
+   const char         *ecore_desktop_icon_find(const char *icon, 
+   					       const char *icon_size,
+					       const char *icon_theme);
 
    Ecore_Desktop_Tree *ecore_desktop_menu_get(char *file);
 
Index: ecore_desktop_icon.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop_icon.c,v
retrieving revision 1.6
diff -u -r1.6 ecore_desktop_icon.c
--- ecore_desktop_icon.c	16 Aug 2006 08:50:39 -0000	1.6
+++ ecore_desktop_icon.c	16 Aug 2006 20:43:17 -0000
@@ -5,8 +5,9 @@
 
 //#define DEBUG 1
 
-static char        *_ecore_desktop_icon_find0(char *icon, char *icon_size,
-					      char *icon_theme);
+static const char   *_ecore_desktop_icon_find0(const char *icon, 
+					      const char *icon_size,
+					      const char *icon_theme);
 
 static const char  *ext[] = { ".png", ".svgz", ".svg", ".xpm", "", NULL };
 
@@ -32,11 +33,12 @@
  * @ingroup Ecore_Desktop_Icon_Group
  */
 
-char               *
-ecore_desktop_icon_find(char *icon, char *icon_size, char *icon_theme)
+const char               *
+ecore_desktop_icon_find(const char *icon, const char *icon_size, const char *icon_theme)
 {
    char                icn[MAX_PATH], path[MAX_PATH];
-   char               *dir, *home;
+   const char         *dir; 
+   char               *home;
 
    if (icon == NULL)
       return NULL;
@@ -89,8 +91,8 @@
  * @param   icon_theme The icon theme to search in.
  * @return  The full path to the found icon.
  */
-static char        *
-_ecore_desktop_icon_find0(char *icon, char *icon_size, char *icon_theme)
+static const char        *
+_ecore_desktop_icon_find0(const char *icon, const char *icon_size, const char *icon_theme)
 {
    /*  NOTES ON OPTIMIZATIONS
     *
@@ -118,7 +120,8 @@
     */
 
    char                icn[MAX_PATH], path[MAX_PATH];
-   char               *theme_path, *found;
+   char               *theme_path;
+   const char         *found;
 
    if ((icon == NULL) || (icon[0] == '\0'))
       return NULL;
@@ -174,7 +177,7 @@
 			    int                 wanted_size;
 			    int                 minimal_size = INT_MAX;
 			    int                 i;
-			    char               *closest = NULL;
+			    const char         *closest = NULL;
 			    char               *directory;
 
 			    wanted_size = atoi(icon_size);