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

Re: gEDA-user: gschem symbol search order



Carlos Nieves Ónega writes:
 > [...]
 > > 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.

The way it was done the list returned by s_clib_search_basename() was
in the same order as the directories. It seems logival. They are not
anymore. The least you can do is add a note for this fact.

 >  - It also makes sense to change the search function instead of changing
 > every function calling it.

The existing code is wrong. The very problem is that the code you are
mentionning is repeated every where in the code. 

There should be a function that specifically call the
s_clib_search_basename() function and take the first (or last in my
view) of the returned value. 

It should also be responsible for the message informing the user of
more than one symbol with that name.

Ideally it should also take care of asking the user if choosing this
symbol is correct. This has previously been discussed here.

Not only it would have fixed the code and introduced possible future
enhancements but it would have improved the overall quality of the
project.

 >  - I like to use a double-linked list whenever I need to go forward and
 > backwards in a list.

There is no need to go backwards on this list.

 >  - The penalty of using a GList instead of a GSList is only a pointer
 > for each library node. 

True.

 >  - No user will be using thousands of libraries at the same time so the
 > memory consumption won't be increased so much.

True.

 >  - It makes programmer's life easier.

I am wondering how since all access to the component library is
through functions in s_clib.c. Plus GList and GSList basically share
the same API.



Patrick


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