Re: [AD] config function naming

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Fri, 2009-03-13 at 11:34 +1100, Peter Wang wrote:
> Elias brought up the example of naming of the config functions,
> so let's try to fix that:
> 
> al_config_add_comment   -> al_add_config_comment
> al_config_add_section   -> al_add_config_section
> al_config_create        -> al_create_config
> al_config_destroy       -> al_destroy_config
> al_config_get_value     -> al_get_config_value
> al_config_merge         -> al_merge_config
> al_config_merge_into    -> al_merge_config_into
> al_config_read          -> al_load_config_file
> al_config_set_value     -> al_set_config_value
> al_config_write         -> al_save_config_file
> 
> I'm not sure about al_merge_config/al_merge_config_into.  al_merge_config
> doesn't suggest it returns a new config.  More importantly, though, the
> behaviour of the function is a little bit complex as it's not obvious what
> to do with comments so we don't keep comments from the second config
> structure at all.  "Merge" might not be the best word.
> 

I think the new names are all fine, except maybe do this:

al_config_read -> al_load_config

That way it's in sync with al_load_bitmap/al_load_sample/... No reason
to append _file.

About al_merge_config, I wouldn't mind removing the function completely,
and rename al_merge_config_into into al_merge_config. Then instead of:

c3 = al_merge_config(c1, c2)

you would have:

c3 = al_create_config()
al_merge_config(cfg, c1)
al_merge_config(cfg, c2)

About the comments, I think we should change the implementation so
comments from the second file actually are retained, but only if the
first one has no comments.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/