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

gEDA-cvs: CVS update: s_clib.c



  User: cnieves 
  Date: 06/12/05 14:39:15

  Modified:    .        s_clib.c
  Log:
  Converted the clib_directories list into a double linked list and 
  
  reversed the search order (last added directories first).
  
  
  
  
  Revision  Changes    Path
  1.19      +17 -15    eda/geda/gaf/libgeda/src/s_clib.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_clib.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/s_clib.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- s_clib.c	5 Jul 2006 03:13:38 -0000	1.18
  +++ s_clib.c	5 Dec 2006 19:39:14 -0000	1.19
  @@ -54,7 +54,7 @@
   
   void s_clib_free (void);
   
  -static GSList *clib_directories = NULL;
  +static GList *clib_directories = NULL;
   
   static GHashTable *clib_cache = NULL;
   
  @@ -85,7 +85,7 @@
     g_free (key);
     if (value != NULL) {
       /* value is a singly-linked list of strings */
  -    g_slist_foreach (value, (GFunc)g_free, NULL);
  +    g_list_foreach (value, (GFunc)g_free, NULL);
       g_slist_free ((GSList*)value);
     }
   }
  @@ -97,8 +97,8 @@
   void s_clib_free (void)
   {
     if (clib_directories != NULL) {
  -    g_slist_foreach (clib_directories, (GFunc)g_free, NULL);
  -    g_slist_free (clib_directories);
  +    g_list_foreach (clib_directories, (GFunc)g_free, NULL);
  +    g_list_free (clib_directories);
       clib_directories = NULL;
     }
   
  @@ -119,13 +119,13 @@
   void s_clib_add_directory (const gchar *directory)
   {
     /* search for directory in clib_directories */
  -  if (!g_slist_find_custom (clib_directories,
  +  if (!g_list_find_custom (clib_directories,
                               directory,
                               (GCompareFunc) g_strcasecmp))
     {
       /* directory not yet in the list of known directories */
       /* add directory to list */
  -    clib_directories = g_slist_append (clib_directories,
  +    clib_directories = g_list_append (clib_directories,
                                          g_strdup (directory));
     }
     
  @@ -141,7 +141,7 @@
    *  The returned value is owned by libgeda and must not be modified or freed.
    *
    */
  -const GSList *s_clib_get_directories()
  +const GList *s_clib_get_directories()
   {
     return clib_directories;
   }
  @@ -162,7 +162,7 @@
     GSList *ret = NULL;
   
     /* check directory is in clib_directories */
  -  if (g_slist_find_custom (clib_directories,
  +  if (g_list_find_custom (clib_directories,
                              directory,
                              (GCompareFunc) g_strcasecmp) == NULL)
     {
  @@ -218,7 +218,8 @@
    */
   const GSList *s_clib_search_basename(const gchar *basename)
   {
  -  GSList *ret, *tmp;
  +  GSList *ret; 
  +  GList *tmp;
     
     /* first check if basename is in cache */
     ret = g_hash_table_lookup (clib_cache, basename);
  @@ -228,7 +229,8 @@
     }
   
     /* looks like we have to search for basename in the library */
  -  for (tmp = clib_directories; tmp != NULL; tmp = g_slist_next (tmp)) {
  +  for (tmp = g_list_last(clib_directories); 
  +       tmp != NULL; tmp = g_list_previous (tmp)) {
       gchar *dir_name  = (gchar*)tmp->data;
       gchar *file_name = g_strconcat (dir_name,
                                       G_DIR_SEPARATOR_S,
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs