From: Nathan I. <nin...@gm...> - 2007-11-04 22:59:09
|
On 11/4 On 11/4/07, Peter Wehrfritz <pet...@we...> wrote: > > 3) What is the purpose of the group name? Currently it is only used > during the creation to check if the group name is an unique string, > otherwise it fails. We could simply remove it, without any feature loss. > It'd save memory and the author doesn't need to worry about an unique > name. Or was the idea to avoid the use of static vars like the following > little example could look like: > > group = ecore_path_group_find("my paths"); > > if (!group) { > /* group doesn't exist, create it now */ > group = ecore_path_group_new("my paths"); > ... > } > > Then we need to expose the __ecore_path_group_find() function. Iirc, it was so that it could be easily accessed by other components without providing an exported global. In reality this is probably more dangerous than useful. > > 4) Why is it using the group id to identify the group and not a pointer > to Ecore_Path_Group. Using the group id implies a linear search. Sure, > probably not a notable waste of time, but i don't see any benefit. Well, the id could be a hash key instead and avoid the linear scan. But it would probably be better to return the pointer to the struct. to return the pointer to the struct. to return the pointer to the struct./07, Peter Wehrfritz <pet...@we...> wrote: > > 3) What is the purpose of the group name? Currently it is only used > during the creation to check if the group name is an unique string, > otherwise it fails. We could simply remove it, without any feature loss. > It'd save memory and the author doesn't need to worry about an unique > name. Or was the idea to avoid the use of static vars like the following > little example could look like: > > group = ecore_path_group_find("my paths"); > > if (!group) { > /* group doesn't exist, create it now */ > group = ecore_path_group_new("my paths"); > ... > } > > Then we need to expose the __ecore_path_group_find() function. > > 4) Why is it using the group id to identify the group and not a pointer > to Ecore_Path_Group. Using the group id implies a linear search. Sure, > probably not a notable waste of time, but i don't see any benefit. |