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

Re: gEDA-user: gschem symbol search order



Hi Patrick:

El vie, 15-12-2006 a las 17:46 +0100, Patrick Bernaud escribiÃ:
> Carlos Nieves Ãnega writes:
>  > [...]
>  > > 	Ack!  This is changed behavior.  It seems that the order is
>  > > now different then what I expected.  libgeda/gschem should always search
>  > > the component libraries in the reverse order (that is your local libraries
>  > > should be found first), however it is not doing that.  This is a bug
>  > > and will be fixed.   Thanks for the bug report.
>  > 
>  > Hopefully it's fixed now in HEAD.
> 
> I am curious on the reason that made you clib_directories from a
> GSList to a GList. Correct me if I am wrong but this code is correct
> and does not require a GList.
> 
> The bug is not in libgeda/s_clib.c but in all the places where
> s_clib_search_basename() is used: the function calling it must be
> careful enough to take the last item from the list. The bug is HERE
> (libgeda and gschem).
> 
> So a better way to fix this problem would have been to use
> g_slist_last() on the returned list and not to modify s_clib.c.

Here are the reasons:
 - All the existing code asserts that the first node returned by
s_clib_search_basename is the first entry to be used. This makes sense.
 - It also makes sense to change the search function instead of changing
every function calling it.
 - The above two points suggests to a change in the search function,
searching backwards instead of forwards.
 - I like to use a double-linked list whenever I need to go forward and
backwards in a list.
 - The penalty of using a GList instead of a GSList is only a pointer
for each library node. 
 - No user will be using thousands of libraries at the same time so the
memory consumption won't be increased so much.
 - It makes programmer's life easier.

Regards,

Carlos




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