Re: [AD] list_config_entries

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


On 2005-11-27, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> Attached again a patch I sent some months ago, against new_api_branch..
> I'm not sure how well it will fit into the new config system, but I find
> it useful right now. 

Sorry about the late reply.

> Index: docs/src/allegro._tx
> ===================================================================
> RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
> retrieving revision 1.249.2.13
> diff -r1.249.2.13 allegro._tx
> 2157a2158,2198
> > @@int @list_config_entries(const char *section, const char ***names);
> > @xref set_config_file, get_config_string
> > @shortdesc Lists the names of all entries in a config section
> >    This function can be used to get a list of all entries in the given config
> >    section. The names parameter is a pointer to an array of strings. If it
> >    points to a NULL pointer, the list will be allocated, else it will be
> >    re-allocated. You should free the list yourself with free if you don't need
> >    it anymore. See the following example for how you can use it, it will print
> >    out the complete contents of the current configuration:

This is no good.  The malloc() that the Allegro DLL uses may not be
compatible with the free() from the user program.  You must either
provide free_config_entries_list() function or pass the implementation
of malloc() to list_config_sections(), e.g. by making it a macro like
ustrdup().  I much prefer the former.

You forgot to add function prototypes for list_config_entries() and
list_config_sections().

Peter

PS. Please write more descriptive log messages.





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