On Thursday, 14 April 2005, at 06:35:50 (-0700),
E CVS List wrote:

>  {
>     DIR                *dirp;
>     struct dirent      *dp;
> -   Ecore_DList        *list;
> +   Ecore_List        *list;
>  
>     dirp = opendir(dir);
>     if (!dirp) return NULL;
> -   list = ecore_dlist_new();
> +   list = ecore_list_new();
>     while ((dp = readdir(dirp)))
>       {
>       if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
> @@ -200,27 +200,27 @@
>            char *file, *f;
>  
>            /* insertion sort */
> -          ecore_dlist_goto_first(list);
> -          while ((file = ecore_dlist_next(list)))
> +          ecore_list_goto_first(list);
> +          while ((file = ecore_list_current(list)))
>              {
>                 if (strcmp(file, dp->d_name) > 0)
>                   {
> -                    ecore_dlist_previous(list);
>                      f = strdup(dp->d_name);
> -                    ecore_dlist_insert(list, f);
> +                    ecore_list_insert(list, f);
>                      break;
>                   }
> +               ecore_list_next(list);
>              }
>            /* nowhwre to go? just append it */
>            if (!file)
>              {
>                 f = strdup(dp->d_name);
> -               ecore_dlist_append(list, f);
> +               ecore_list_append(list, f);
>              }
>         }
>       }
>     closedir(dirp);
>  
> -   ecore_dlist_goto_first(list);
> -   return ECORE_LIST(list);
> +   ecore_list_goto_first(list);
> +   return list;
>  }

Now see, if you guys were using LibAST lists, or at least a similar
technique, changing list types (linked, doubly-linked, array, tree,
etc.) would be a hell of a lot easier and could be done either at
runtime or with a 1-line code change.

There's a reason I implemented the concept of interface classes (a la
Java) for things like this. :)

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <[EMAIL PROTECTED]>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "Confucious say, 'Baseball wrong!  Man with four balls cannot walk!'"
                                                          -- Todd Lusk


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to